Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / chrome / common / BUILD.gn
blobeceb63affdac5e0db3b1d02bcbc34cd59bca6e61
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("//tools/grit/grit_rule.gni")
6 import("//third_party/mojo/src/mojo/public/tools/bindings/mojom.gni")
7 import("//chrome/version.gni")
9 gypi_values = exec_script("//build/gypi_to_gn.py",
10                           [ rebase_path("../chrome_common.gypi") ],
11                           "scope",
12                           [ "../chrome_common.gypi" ])
14 # GYP version: chrome/chrome_resources.gyp:chrome_resources
15 #              (generate_common_resources action)
16 grit("resources") {
17   source = "common_resources.grd"
18   output_dir = "$root_gen_dir/chrome"
19   output_name = "common_resources"
20   outputs = [
21     "grit/common_resources.h",
22     "common_resources.pak",
23   ]
26 # GYP version: chrome/chrome_resources.gyp:chrome_resources
27 #              (generate_extensions_api_resources action)
28 if (enable_extensions) {
29   grit("extensions_api_resources") {
30     source = "extensions_api_resources.grd"
31     output_dir = "$root_gen_dir/chrome"
32     outputs = [
33       "grit/extensions_api_resources.h",
34       "extensions_api_resources.pak",
35     ]
36   }
39 # GYP version: chrome/chrome_common.gyp:common
40 static_library("common") {
41   sources = rebase_path(gypi_values.chrome_common_sources, ".", "//chrome")
42   defines = []
44   configs += [
45     "//build/config:precompiled_headers",
46     "//build/config/compiler:wexit_time_destructors",
47   ]
49   public_deps = [
50     "//chrome/common:constants",
51     "//chrome/common/safe_browsing:proto",
52   ]
53   deps = [
54     "//base:base",
55     "//base:i18n",
56     "//base:prefs",
57     "//base:base_static",
58     "//chrome:resources",
59     "//chrome:strings",
60     "//chrome/app/theme:theme_resources",
61     "//chrome/common/variations:fieldtrial_testing_config",
62     "//chrome/installer/util",
63     "//components/cloud_devices/common",
64     "//components/component_updater",
65     "//components/content_settings/core/common",
66     "//components/crash_keys",
67     "//components/favicon_base",
68     "//components/gcm_driver/common",
69     "//components/json_schema",
70     "//components/metrics",
71     "//components/omnibox/common",
72     "//components/policy:policy_component_common",
73     "//components/translate/core/common",
74     "//components/url_formatter",
75     "//components/variations",
76     "//components/version_info",
77     "//content/public/common",
78     "//crypto",
79     "//extensions/common:common_constants",
80     "//net",
81     "//skia",
82     "//third_party/icu",
83     "//third_party/zlib:zip",
84     "//ui/resources:resources",
85     "//url",
86   ]
88   if (is_ios) {
89     sources += [
90       # Use this Mac file that was filtered out.
91       "channel_info_mac.mm",
92     ]
93     sources -= [
94       "resource_usage_reporter_type_converters.cc",
95       "resource_usage_reporter_type_converters.h",
96     ]
97   } else {
98     # Non-iOS.
99     deps += [
100       ":mojo_bindings",
101       "//components/visitedlink/common",
102       "//components/autofill/content/common",
103       "//components/autofill/core/common",
104       "//components/password_manager/content/common",
105       "//components/password_manager/core/common",
106       "//components/signin/core/common",
107       "//components/translate/content/common",
108       "//ipc",
109       "//third_party/re2",
110       "//third_party/widevine/cdm:version_h",
111     ]
112     public_deps += [
113       "//chrome/common/net",
114       "//third_party/mojo/src/mojo/public/cpp/bindings",
115     ]
116   }
118   if (enable_extensions) {
119     sources += rebase_path(gypi_values.chrome_common_extensions_sources,
120                            ".",
121                            "//chrome")
122     deps += [
123       "//device/usb",
124       "//chrome/common/extensions/api",
125       "//extensions/common",
126       "//extensions/common/api",
127       "//extensions:extensions_resources",
128       "//extensions/strings",
129       "//media/cast:net",
130     ]
131     if (is_chromeos) {
132       sources +=
133           rebase_path(gypi_values.chrome_common_extensions_chromeos_sources,
134                       ".",
135                       "//chrome")
136     }
137   }
139   if (is_win || is_mac) {
140     sources +=
141         rebase_path(gypi_values.chrome_common_win_mac_sources, ".", "//chrome")
142     deps += [ "//breakpad:client" ]
143   }
144   if (is_win || is_mac || is_chromeos) {
145     if (use_openssl) {
146       sources += rebase_path(
147               gypi_values.chrome_common_networking_private_sources_openssl,
148               ".",
149               "//chrome")
151       # networking_private_crypto_openssl.cc depends on boringssl.
152       deps += [ "//third_party/boringssl" ]
153     } else {
154       sources +=
155           rebase_path(gypi_values.chrome_common_networking_private_sources_nss,
156                       ".",
157                       "//chrome")
158     }
159   }
160   if (is_mac) {
161     sources +=
162         rebase_path(gypi_values.chrome_common_mac_sources, ".", "//chrome")
163     deps += [ ":app_mode_app_support" ]
164   }
166   if (enable_nacl) {
167     deps += [ "//components/nacl:nacl_common" ]
168   }
170   # Printing.
171   if (enable_basic_printing || enable_print_preview) {
172     deps += [
173       "//components/printing/common",
174       "//printing",
175     ]
176     if (enable_print_preview) {
177       # Full printing support.
178       sources += rebase_path(gypi_values.chrome_common_service_process_sources,
179                              ".",
180                              "//chrome")
181     }
182   }
184   if (enable_service_discovery) {
185     sources += [
186       "local_discovery/service_discovery_client.cc",
187       "local_discovery/service_discovery_client.h",
188     ]
189   }
190   if (enable_mdns) {
191     sources += [
192       "local_discovery/service_discovery_client_impl.cc",
193       "local_discovery/service_discovery_client_impl.h",
194     ]
195   }
197   if (is_android) {
198     sources -= [
199       "badge_util.cc",
200       "channel_info_posix.cc",
201       "icon_with_badge_image_source.cc",
202       "media_galleries/metadata_types.h",
203     ]
204   } else {
205     # Non-Android.
206     sources +=
207         rebase_path(gypi_values.chrome_common_importer_sources, ".", "//chrome")
208   }
210   if (is_chromeos) {
211     sources -= [ "channel_info_posix.cc" ]
212   }
214   if (is_win) {
215     deps += [
216       "//components/dom_distiller/core",  # Needed by chrome_content_client.cc.
217       "//third_party/wtl",
218     ]
219   }
221   if (enable_mdns) {
222     sources += [ "local_discovery/local_discovery_messages.h" ]
223   }
225   if (is_mac) {
226     sources -= [ "channel_info_posix.cc" ]
227     deps += [
228       "//third_party/mach_override",
229       "//third_party/google_toolbox_for_mac",
230     ]
231   }
233   if (enable_plugins) {
234     sources += [
235       "pepper_flash.cc",
236       "pepper_flash.h",
237       "ppapi_utils.cc",
238       "ppapi_utils.h",
239     ]
240     deps += [ "//third_party/adobe/flash:flapper_version_h" ]
241   }
242   if (enable_plugins && enable_extensions) {
243     sources += [
244       "pepper_permission_util.cc",
245       "pepper_permission_util.h",
246     ]
247   }
248   if (!enable_webrtc) {
249     sources -= [ "media/webrtc_logging_messages.h" ]
250   }
251   if (enable_configuration_policy) {
252     deps += [ "//components/policy" ]
253   }
255   if (safe_browsing_mode == 1) {
256     sources += rebase_path(gypi_values.chrome_common_full_safe_browsing_sources,
257                            ".",
258                            "//chrome")
259   }
262 # This target allows other targets to depend on result_codes.h which is a
263 # header-only dependency, without bringing in all of content.
264 source_set("result_codes") {
265   sources = [
266     "chrome_result_codes.h",
267   ]
270 process_version("make_chrome_version") {
271   template_file = "chrome_version.cc.version"
272   output = "$target_gen_dir/chrome_version.cc"
275 # GN version: chrome/common_constants.gyp:common_constants
276 static_library("constants") {
277   sources = [
278     "chrome_constants.cc",
279     "chrome_constants.h",
280     "chrome_icon_resources_win.cc",
281     "chrome_icon_resources_win.h",
282     "chrome_paths.cc",
283     "chrome_paths.h",
284     "chrome_paths_android.cc",
285     "chrome_paths_internal.h",
286     "chrome_paths_linux.cc",
287     "chrome_paths_mac.mm",
288     "chrome_paths_win.cc",
289     "chrome_switches.cc",
290     "chrome_switches.h",
291     "env_vars.cc",
292     "env_vars.h",
293     "pref_font_script_names-inl.h",
294     "pref_font_webkit_names.h",
295     "pref_names.cc",
296     "pref_names.h",
297     "widevine_cdm_constants.cc",
298     "widevine_cdm_constants.h",
299   ]
301   deps = [
302     ":make_chrome_version",
303     "//base",
304     "//base/third_party/dynamic_annotations",
305     "//components/bookmarks/common",
306     "//third_party/widevine/cdm:version_h",
307   ]
309   if (enable_nacl) {
310     deps += [ "//components/nacl:nacl_switches" ]
311   }
314 source_set("test_support") {
315   testonly = true
316   visibility = [ "//chrome/test:test_support" ]
318   sources = []
320   deps = [
321     ":common",
322     "//base",
323     "//testing/gtest",
324   ]
326   if (is_win || is_mac) {
327     sources += [
328       "media_galleries/picasa_test_util.cc",
329       "media_galleries/picasa_test_util.h",
330       "media_galleries/pmp_test_util.cc",
331       "media_galleries/pmp_test_util.h",
332     ]
333   }
335   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
337   if (enable_extensions) {
338     sources += [
339       "extensions/extension_test_util.cc",
340       "extensions/extension_test_util.h",
341     ]
342   }
345 # GN version: chrome/chrome.gyp:app_mode_app_support
346 static_library("app_mode_app_support") {
347   sources = [
348     "mac/app_mode_chrome_locator.h",
349     "mac/app_mode_chrome_locator.mm",
350     "mac/app_mode_common.h",
351     "mac/app_mode_common.mm",
352   ]
354   deps = [
355     ":constants",
356     "//base",
357   ]
360 mojom("mojo_bindings") {
361   sources = [
362     "resource_usage_reporter.mojom",
363   ]