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/crypto.gni")
8 # You can set the variable 'use_official_google_api_keys' to true
9 # to use the Google-internal file containing official API keys
10 # for Google Chrome even in a developer build. Setting this
11 # variable explicitly to true will cause your build to fail if the
12 # internal file is missing.
14 # The variable is documented here, but not handled in this file;
15 # see //google_apis/determine_use_official_keys.gypi for the
18 # Set the variable to false to not use the internal file, even when
19 # it exists in your checkout.
21 # Leave it unset or set to "" to have the variable
22 # implicitly set to true if you have
23 # src/google_apis/internal/google_chrome_api_keys.h in your
24 # checkout, and implicitly set to false if not.
26 # Note that official builds always behave as if the variable
27 # was explicitly set to true, i.e. they always use official keys,
28 # and will fail to build if the internal file is missing.
29 use_official_google_api_keys = ""
31 # Set these to bake the specified API keys and OAuth client
32 # IDs/secrets into your build.
34 # If you create a build without values baked in, you can instead
35 # set environment variables to provide the keys at runtime (see
36 # src/google_apis/google_api_keys.h for details). Features that
37 # require server-side APIs may fail to work if no keys are
40 # Note that if you are building an official build or if
41 # use_official_google_api_keys has been set to trie (explicitly or
42 # implicitly), these values will be ignored and the official
43 # keys will be used instead.
47 google_default_client_id = ""
50 google_default_client_secret = ""
53 if (use_official_google_api_keys == "") {
54 # Default behavior, check if the key file exists.
55 check_internal_result = exec_script(
56 "build/check_internal.py",
57 [ rebase_path("internal/google_chrome_api_keys.h", root_build_dir) ],
59 use_official_google_api_keys = (check_internal_result == 1)
62 config("key_defines") {
64 if (use_official_google_api_keys) {
65 defines += [ "USE_OFFICIAL_GOOGLE_API_KEYS=1" ]
67 if (google_api_key != "") {
68 defines += [ "GOOGLE_API_KEY=$google_api_key" ]
70 if (google_default_client_id != "") {
71 defines += [ "GOOGLE_DEFAULT_CLIENT_ID=$google_default_client_id" ]
73 if (google_default_client_secret != "") {
74 defines += [ "GOOGLE_DEFAULT_CLIENT_SECRET=$google_default_client_secret" ]
78 source_set("google_apis") {
80 "cup/client_update_protocol.cc",
81 "cup/client_update_protocol.h",
82 "drive/auth_service.cc",
83 "drive/auth_service.h",
84 "drive/auth_service_interface.h",
85 "drive/auth_service_observer.h",
86 "drive/base_requests.cc",
87 "drive/base_requests.h",
88 "drive/drive_api_parser.cc",
89 "drive/drive_api_parser.h",
90 "drive/drive_api_requests.cc",
91 "drive/drive_api_requests.h",
92 "drive/drive_api_url_generator.cc",
93 "drive/drive_api_url_generator.h",
94 "drive/drive_common_callbacks.h",
95 "drive/drive_entry_kinds.h",
96 "drive/gdata_errorcode.cc",
97 "drive/gdata_errorcode.h",
98 "drive/gdata_wapi_requests.cc",
99 "drive/gdata_wapi_requests.h",
100 "drive/gdata_wapi_parser.cc",
101 "drive/gdata_wapi_parser.h",
102 "drive/gdata_wapi_url_generator.cc",
103 "drive/gdata_wapi_url_generator.h",
104 "drive/request_sender.cc",
105 "drive/request_sender.h",
106 "drive/request_util.cc",
107 "drive/request_util.h",
108 "drive/task_util.cc",
110 "drive/time_util.cc",
112 "gaia/dummy_identity_provider.cc",
113 "gaia/dummy_identity_provider.h",
114 "gaia/gaia_auth_consumer.cc",
115 "gaia/gaia_auth_consumer.h",
116 "gaia/gaia_auth_fetcher.cc",
117 "gaia/gaia_auth_fetcher.h",
118 "gaia/gaia_auth_util.cc",
119 "gaia/gaia_auth_util.h",
120 "gaia/gaia_constants.cc",
121 "gaia/gaia_constants.h",
122 "gaia/gaia_oauth_client.cc",
123 "gaia/gaia_oauth_client.h",
124 "gaia/gaia_switches.cc",
125 "gaia/gaia_switches.h",
128 "gaia/google_service_auth_error.cc",
129 "gaia/google_service_auth_error.h",
130 "gaia/identity_provider.cc",
131 "gaia/identity_provider.h",
132 "gaia/merge_session_helper.cc",
133 "gaia/merge_session_helper.h",
134 "gaia/oauth_request_signer.cc",
135 "gaia/oauth_request_signer.h",
136 "gaia/oauth2_access_token_consumer.h",
137 "gaia/oauth2_access_token_fetcher.h",
138 "gaia/oauth2_access_token_fetcher.cc",
139 "gaia/oauth2_access_token_fetcher_impl.cc",
140 "gaia/oauth2_access_token_fetcher_impl.h",
141 "gaia/oauth2_api_call_flow.cc",
142 "gaia/oauth2_api_call_flow.h",
143 "gaia/oauth2_mint_token_flow.cc",
144 "gaia/oauth2_mint_token_flow.h",
145 "gaia/oauth2_token_service.cc",
146 "gaia/oauth2_token_service.h",
147 "gaia/ubertoken_fetcher.cc",
148 "gaia/ubertoken_fetcher.h",
149 "google_api_keys.cc",
154 cflags = [ "/wd4267" ] # size_t -> int
157 configs += [ ":key_defines" ]
164 "//third_party/libxml",
168 sources += [ "cup/client_update_protocol_openssl.cc" ]
170 sources += [ "cup/client_update_protocol_nss.cc" ]
173 if (is_chromeos || is_android) {
175 "gaia/dummy_identity_provider.cc",
176 "gaia/dummy_identity_provider.h",
181 source_set("test_support") {
183 "drive/dummy_auth_service.cc",
184 "drive/dummy_auth_service.h",
185 "drive/test_util.cc",
189 "gaia/fake_identity_provider.cc",
190 "gaia/fake_identity_provider.h",
191 "gaia/fake_oauth2_token_service.cc",
192 "gaia/fake_oauth2_token_service.h",
193 "gaia/mock_url_fetcher_factory.h",
194 "gaia/oauth2_token_service_test_util.cc",
195 "gaia/oauth2_token_service_test_util.h",
200 "//base/test:test_support",
202 "//net:test_support",
204 forward_dependent_configs_from = deps
207 test("google_apis_unittest") {
209 "google_api_keys_unittest.cc",
210 "cup/client_update_protocol_unittest.cc",
211 "drive/base_requests_unittest.cc",
212 "drive/base_requests_server_unittest.cc",
213 "drive/drive_api_requests_unittest.cc",
214 "drive/drive_api_parser_unittest.cc",
215 "drive/drive_api_url_generator_unittest.cc",
216 "drive/gdata_wapi_parser_unittest.cc",
217 "drive/gdata_wapi_requests_unittest.cc",
218 "drive/gdata_wapi_url_generator_unittest.cc",
219 "drive/request_sender_unittest.cc",
220 "drive/request_util_unittest.cc",
221 "drive/time_util_unittest.cc",
222 "gaia/gaia_auth_fetcher_unittest.cc",
223 "gaia/gaia_auth_util_unittest.cc",
224 "gaia/gaia_oauth_client_unittest.cc",
225 "gaia/google_service_auth_error_unittest.cc",
226 "gaia/merge_session_helper_unittest.cc",
227 "gaia/oauth_request_signer_unittest.cc",
228 "gaia/oauth2_access_token_fetcher_impl_unittest.cc",
229 "gaia/oauth2_api_call_flow_unittest.cc",
230 "gaia/oauth2_mint_token_flow_unittest.cc",
231 "gaia/oauth2_token_service_unittest.cc",
232 "gaia/ubertoken_fetcher_unittest.cc",
235 configs += [ ":key_defines" ]
241 "//base/test:run_all_unittests",
248 "drive/base_requests_server_unittest.cc",
249 "drive/drive_api_parser_unittest.cc",
250 "drive/drive_api_requests_unittest.cc",
251 "drive/gdata_wapi_parser_unittest.cc",
252 "drive/gdata_wapi_requests_unittest.cc",