Standardize struct public member variables in ServiceProcessState::StateData
[chromium-blink-merge.git] / google_apis / BUILD.gn
blobb8ab4b61185a802a594b27f2d498daf15f1eb7a7
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/features.gni")
6 import("//testing/test.gni")
8 declare_args() {
9   # You can set the variable 'use_official_google_api_keys' to true
10   # to use the Google-internal file containing official API keys
11   # for Google Chrome even in a developer build.  Setting this
12   # variable explicitly to true will cause your build to fail if the
13   # internal file is missing.
14   #
15   # The variable is documented here, but not handled in this file;
16   # see //google_apis/determine_use_official_keys.gypi for the
17   # implementation.
18   #
19   # Set the variable to false to not use the internal file, even when
20   # it exists in your checkout.
21   #
22   # Leave it unset or set to "" to have the variable
23   # implicitly set to true if you have
24   # src/google_apis/internal/google_chrome_api_keys.h in your
25   # checkout, and implicitly set to false if not.
26   #
27   # Note that official builds always behave as if the variable
28   # was explicitly set to true, i.e. they always use official keys,
29   # and will fail to build if the internal file is missing.
30   use_official_google_api_keys = ""
32   # Set these to bake the specified API keys and OAuth client
33   # IDs/secrets into your build.
34   #
35   # If you create a build without values baked in, you can instead
36   # set environment variables to provide the keys at runtime (see
37   # src/google_apis/google_api_keys.h for details).  Features that
38   # require server-side APIs may fail to work if no keys are
39   # provided.
40   #
41   # Note that if you are building an official build or if
42   # use_official_google_api_keys has been set to trie (explicitly or
43   # implicitly), these values will be ignored and the official
44   # keys will be used instead.
45   google_api_key = ""
47   # See google_api_key.
48   google_default_client_id = ""
50   # See google_api_key.
51   google_default_client_secret = ""
54 if (use_official_google_api_keys == "") {
55   # Default behavior, check if the key file exists.
56   check_internal_result =
57       exec_script("build/check_internal.py",
58                   [ rebase_path("internal/google_chrome_api_keys.h",
59                                 root_build_dir) ],
60                   "value")
61   use_official_google_api_keys = check_internal_result == 1
64 config("key_defines") {
65   defines = []
66   if (use_official_google_api_keys) {
67     defines += [ "USE_OFFICIAL_GOOGLE_API_KEYS=1" ]
68   }
69   if (google_api_key != "") {
70     defines += [ "GOOGLE_API_KEY=$google_api_key" ]
71   }
72   if (google_default_client_id != "") {
73     defines += [ "GOOGLE_DEFAULT_CLIENT_ID=$google_default_client_id" ]
74   }
75   if (google_default_client_secret != "") {
76     defines += [ "GOOGLE_DEFAULT_CLIENT_SECRET=$google_default_client_secret" ]
77   }
80 source_set("google_apis") {
81   sources = [
82     "gaia/account_tracker.cc",
83     "gaia/account_tracker.h",
84     "gaia/gaia_auth_consumer.cc",
85     "gaia/gaia_auth_consumer.h",
86     "gaia/gaia_auth_fetcher.cc",
87     "gaia/gaia_auth_fetcher.h",
88     "gaia/gaia_auth_util.cc",
89     "gaia/gaia_auth_util.h",
90     "gaia/gaia_constants.cc",
91     "gaia/gaia_constants.h",
92     "gaia/gaia_oauth_client.cc",
93     "gaia/gaia_oauth_client.h",
94     "gaia/gaia_switches.cc",
95     "gaia/gaia_switches.h",
96     "gaia/gaia_urls.cc",
97     "gaia/gaia_urls.h",
98     "gaia/google_service_auth_error.cc",
99     "gaia/google_service_auth_error.h",
100     "gaia/identity_provider.cc",
101     "gaia/identity_provider.h",
102     "gaia/merge_session_helper.cc",
103     "gaia/merge_session_helper.h",
104     "gaia/oauth2_access_token_consumer.h",
105     "gaia/oauth2_access_token_fetcher.cc",
106     "gaia/oauth2_access_token_fetcher.h",
107     "gaia/oauth2_access_token_fetcher_impl.cc",
108     "gaia/oauth2_access_token_fetcher_impl.h",
109     "gaia/oauth2_api_call_flow.cc",
110     "gaia/oauth2_api_call_flow.h",
111     "gaia/oauth2_mint_token_flow.cc",
112     "gaia/oauth2_mint_token_flow.h",
113     "gaia/oauth2_token_service.cc",
114     "gaia/oauth2_token_service.h",
115     "gaia/oauth2_token_service_request.cc",
116     "gaia/oauth2_token_service_request.h",
117     "gaia/oauth_request_signer.cc",
118     "gaia/oauth_request_signer.h",
119     "gaia/ubertoken_fetcher.cc",
120     "gaia/ubertoken_fetcher.h",
121     "google_api_keys.cc",
122     "google_api_keys.h",
123   ]
125   configs += [
126     ":key_defines",
127     "//build/config/compiler:no_size_t_to_int_warning",
128   ]
130   deps = [
131     "//base",
132     "//base/third_party/dynamic_annotations",
133     "//crypto",
134     "//net",
135     "//third_party/libxml",
136   ]
138   if (enable_extensions) {
139     sources += [
140       "drive/auth_service.cc",
141       "drive/auth_service.h",
142       "drive/auth_service_interface.h",
143       "drive/auth_service_observer.h",
144       "drive/base_requests.cc",
145       "drive/base_requests.h",
146       "drive/drive_api_error_codes.cc",
147       "drive/drive_api_error_codes.h",
148       "drive/drive_api_parser.cc",
149       "drive/drive_api_parser.h",
150       "drive/drive_api_requests.cc",
151       "drive/drive_api_requests.h",
152       "drive/drive_api_url_generator.cc",
153       "drive/drive_api_url_generator.h",
154       "drive/drive_common_callbacks.h",
155       "drive/request_sender.cc",
156       "drive/request_sender.h",
157       "drive/request_util.cc",
158       "drive/request_util.h",
159       "drive/task_util.cc",
160       "drive/task_util.h",
161       "drive/time_util.cc",
162       "drive/time_util.h",
163     ]
164   }
167 source_set("test_support") {
168   testonly = true
169   sources = [
170     "gaia/fake_gaia.cc",
171     "gaia/fake_gaia.h",
172     "gaia/fake_identity_provider.cc",
173     "gaia/fake_identity_provider.h",
174     "gaia/fake_oauth2_token_service.cc",
175     "gaia/fake_oauth2_token_service.h",
176     "gaia/mock_url_fetcher_factory.h",
177     "gaia/oauth2_token_service_test_util.cc",
178     "gaia/oauth2_token_service_test_util.h",
179   ]
181   public_deps = [
182     "//base",
183     "//base/test:test_support",
184     "//net",
185     "//net:test_support",
186   ]
188   deps = [
189     ":google_apis",
190   ]
191   if (enable_extensions) {
192     sources += [
193       "drive/dummy_auth_service.cc",
194       "drive/dummy_auth_service.h",
195       "drive/test_util.cc",
196       "drive/test_util.h",
197     ]
198   }
201 test("google_apis_unittests") {
202   sources = [
203     "gaia/gaia_auth_fetcher_unittest.cc",
204     "gaia/gaia_auth_util_unittest.cc",
205     "gaia/gaia_oauth_client_unittest.cc",
206     "gaia/google_service_auth_error_unittest.cc",
207     "gaia/merge_session_helper_unittest.cc",
208     "gaia/oauth2_access_token_fetcher_impl_unittest.cc",
209     "gaia/oauth2_api_call_flow_unittest.cc",
210     "gaia/oauth2_mint_token_flow_unittest.cc",
211     "gaia/oauth2_token_service_unittest.cc",
212     "gaia/oauth_request_signer_unittest.cc",
213     "gaia/ubertoken_fetcher_unittest.cc",
214     "google_api_keys_unittest.cc",
215   ]
217   configs += [ ":key_defines" ]
219   deps = [
220     ":google_apis",
221     ":test_support",
222     "//base",
223     "//base/test:run_all_unittests",
224     "//testing/gmock",
225     "//testing/gtest",
226   ]
228   if (enable_extensions) {
229     sources += [
230       "drive/base_requests_server_unittest.cc",
231       "drive/base_requests_unittest.cc",
232       "drive/drive_api_parser_unittest.cc",
233       "drive/drive_api_requests_unittest.cc",
234       "drive/drive_api_url_generator_unittest.cc",
235       "drive/request_sender_unittest.cc",
236       "drive/request_util_unittest.cc",
237       "drive/time_util_unittest.cc",
238     ]
239   }