Use O_NONBLOCK when opening audio pipe on linux.
[chromium-blink-merge.git] / google_apis / BUILD.gn
blobbf71ce3bc0290b886271c434a54ef5bf5764bee9
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")
7 declare_args() {
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.
13   #
14   # The variable is documented here, but not handled in this file;
15   # see //google_apis/determine_use_official_keys.gypi for the
16   # implementation.
17   #
18   # Set the variable to false to not use the internal file, even when
19   # it exists in your checkout.
20   #
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.
25   #
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.
33   #
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
38   # provided.
39   #
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.
44   google_api_key = ""
46   # See google_api_key.
47   google_default_client_id = ""
49   # See google_api_key.
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 =
56       exec_script("build/check_internal.py",
57                   [ rebase_path("internal/google_chrome_api_keys.h",
58                                 root_build_dir) ],
59                   "value")
60   use_official_google_api_keys = check_internal_result == 1
63 config("key_defines") {
64   defines = []
65   if (use_official_google_api_keys) {
66     defines += [ "USE_OFFICIAL_GOOGLE_API_KEYS=1" ]
67   }
68   if (google_api_key != "") {
69     defines += [ "GOOGLE_API_KEY=$google_api_key" ]
70   }
71   if (google_default_client_id != "") {
72     defines += [ "GOOGLE_DEFAULT_CLIENT_ID=$google_default_client_id" ]
73   }
74   if (google_default_client_secret != "") {
75     defines += [ "GOOGLE_DEFAULT_CLIENT_SECRET=$google_default_client_secret" ]
76   }
79 source_set("google_apis") {
80   sources = [
81     "gaia/account_tracker.cc",
82     "gaia/account_tracker.h",
83     "gaia/gaia_auth_consumer.cc",
84     "gaia/gaia_auth_consumer.h",
85     "gaia/gaia_auth_fetcher.cc",
86     "gaia/gaia_auth_fetcher.h",
87     "gaia/gaia_auth_util.cc",
88     "gaia/gaia_auth_util.h",
89     "gaia/gaia_constants.cc",
90     "gaia/gaia_constants.h",
91     "gaia/gaia_oauth_client.cc",
92     "gaia/gaia_oauth_client.h",
93     "gaia/gaia_switches.cc",
94     "gaia/gaia_switches.h",
95     "gaia/gaia_urls.cc",
96     "gaia/gaia_urls.h",
97     "gaia/google_service_auth_error.cc",
98     "gaia/google_service_auth_error.h",
99     "gaia/identity_provider.cc",
100     "gaia/identity_provider.h",
101     "gaia/merge_session_helper.cc",
102     "gaia/merge_session_helper.h",
103     "gaia/oauth_request_signer.cc",
104     "gaia/oauth_request_signer.h",
105     "gaia/oauth2_access_token_consumer.h",
106     "gaia/oauth2_access_token_fetcher.cc",
107     "gaia/oauth2_access_token_fetcher.h",
108     "gaia/oauth2_access_token_fetcher_impl.cc",
109     "gaia/oauth2_access_token_fetcher_impl.h",
110     "gaia/oauth2_api_call_flow.cc",
111     "gaia/oauth2_api_call_flow.h",
112     "gaia/oauth2_mint_token_flow.cc",
113     "gaia/oauth2_mint_token_flow.h",
114     "gaia/oauth2_token_service.cc",
115     "gaia/oauth2_token_service.h",
116     "gaia/oauth2_token_service_request.cc",
117     "gaia/oauth2_token_service_request.h",
118     "gaia/ubertoken_fetcher.cc",
119     "gaia/ubertoken_fetcher.h",
120     "google_api_keys.cc",
121     "google_api_keys.h",
122   ]
124   if (is_win) {
125     cflags = [ "/wd4267" ]  # size_t -> int
126   }
128   configs += [ ":key_defines" ]
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_parser.cc",
147       "drive/drive_api_parser.h",
148       "drive/drive_api_requests.cc",
149       "drive/drive_api_requests.h",
150       "drive/drive_api_url_generator.cc",
151       "drive/drive_api_url_generator.h",
152       "drive/drive_common_callbacks.h",
153       "drive/gdata_errorcode.cc",
154       "drive/gdata_errorcode.h",
155       "drive/gdata_wapi_requests.cc",
156       "drive/gdata_wapi_requests.h",
157       "drive/gdata_wapi_parser.cc",
158       "drive/gdata_wapi_parser.h",
159       "drive/gdata_wapi_url_generator.cc",
160       "drive/gdata_wapi_url_generator.h",
161       "drive/request_sender.cc",
162       "drive/request_sender.h",
163       "drive/request_util.cc",
164       "drive/request_util.h",
165       "drive/task_util.cc",
166       "drive/task_util.h",
167       "drive/time_util.cc",
168       "drive/time_util.h",
169     ]
170   }
173 source_set("test_support") {
174   testonly = true
175   sources = [
176     "gaia/fake_gaia.cc",
177     "gaia/fake_gaia.h",
178     "gaia/fake_identity_provider.cc",
179     "gaia/fake_identity_provider.h",
180     "gaia/fake_oauth2_token_service.cc",
181     "gaia/fake_oauth2_token_service.h",
182     "gaia/mock_url_fetcher_factory.h",
183     "gaia/oauth2_token_service_test_util.cc",
184     "gaia/oauth2_token_service_test_util.h",
185   ]
187   public_deps = [
188     "//base",
189     "//base/test:test_support",
190     "//net",
191     "//net:test_support",
192   ]
194   if (enable_extensions) {
195     sources += [
196       "drive/dummy_auth_service.cc",
197       "drive/dummy_auth_service.h",
198       "drive/test_util.cc",
199       "drive/test_util.h",
200     ]
201   }
204 test("google_apis_unittest") {
205   sources = [
206     "google_api_keys_unittest.cc",
207     "gaia/gaia_auth_fetcher_unittest.cc",
208     "gaia/gaia_auth_util_unittest.cc",
209     "gaia/gaia_oauth_client_unittest.cc",
210     "gaia/google_service_auth_error_unittest.cc",
211     "gaia/merge_session_helper_unittest.cc",
212     "gaia/oauth_request_signer_unittest.cc",
213     "gaia/oauth2_access_token_fetcher_impl_unittest.cc",
214     "gaia/oauth2_api_call_flow_unittest.cc",
215     "gaia/oauth2_mint_token_flow_unittest.cc",
216     "gaia/oauth2_token_service_unittest.cc",
217     "gaia/ubertoken_fetcher_unittest.cc",
218   ]
220   configs += [ ":key_defines" ]
222   deps = [
223     ":google_apis",
224     ":test_support",
225     "//base",
226     "//base/test:run_all_unittests",
227     "//testing/gmock",
228     "//testing/gtest",
229   ]
231   if (enable_extensions) {
232     sources += [
233       "drive/base_requests_server_unittest.cc",
234       "drive/base_requests_unittest.cc",
235       "drive/drive_api_parser_unittest.cc",
236       "drive/drive_api_requests_unittest.cc",
237       "drive/drive_api_url_generator_unittest.cc",
238       "drive/gdata_wapi_parser_unittest.cc",
239       "drive/gdata_wapi_requests_unittest.cc",
240       "drive/gdata_wapi_url_generator_unittest.cc",
241       "drive/request_sender_unittest.cc",
242       "drive/request_util_unittest.cc",
243       "drive/time_util_unittest.cc",
244     ]
245   }