Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / common / BUILD.gn
blob7a8f7a71f61a8dcb5440f118209c9b3a7659bbc1
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/strings",
74     "//components/translate/core/common",
75     "//components/url_formatter",
76     "//components/variations",
77     "//components/version_info",
78     "//content/public/common",
79     "//crypto",
80     "//extensions/common:common_constants",
81     "//net",
82     "//skia",
83     "//third_party/icu",
84     "//third_party/zlib:zip",
85     "//ui/resources:resources",
86     "//url",
87   ]
89   if (is_ios) {
90     sources += [
91       # Use this Mac file that was filtered out.
92       "channel_info_mac.mm",
93     ]
94     sources -= [
95       "resource_usage_reporter_type_converters.cc",
96       "resource_usage_reporter_type_converters.h",
97     ]
98   } else {
99     # Non-iOS.
100     deps += [
101       ":mojo_bindings",
102       "//components/visitedlink/common",
103       "//components/autofill/content/common",
104       "//components/autofill/core/common",
105       "//components/password_manager/content/common",
106       "//components/password_manager/core/common",
107       "//components/signin/core/common",
108       "//components/translate/content/common",
109       "//ipc",
110       "//third_party/re2",
111       "//third_party/widevine/cdm:version_h",
112     ]
113     public_deps += [
114       "//chrome/common/net",
115       "//third_party/mojo/src/mojo/public/cpp/bindings",
116     ]
117   }
119   if (enable_extensions) {
120     sources += rebase_path(gypi_values.chrome_common_extensions_sources,
121                            ".",
122                            "//chrome")
123     deps += [
124       "//device/usb",
125       "//chrome/common/extensions/api",
126       "//extensions/common",
127       "//extensions/common/api",
128       "//extensions:extensions_resources",
129       "//extensions/strings",
130       "//media/cast:net",
131     ]
132     if (is_chromeos) {
133       sources +=
134           rebase_path(gypi_values.chrome_common_extensions_chromeos_sources,
135                       ".",
136                       "//chrome")
137     }
138   }
140   if (is_win || is_mac) {
141     sources +=
142         rebase_path(gypi_values.chrome_common_win_mac_sources, ".", "//chrome")
143     deps += [ "//breakpad:client" ]
144   }
145   if (is_win || is_mac || is_chromeos) {
146     if (use_openssl) {
147       sources += rebase_path(
148               gypi_values.chrome_common_networking_private_sources_openssl,
149               ".",
150               "//chrome")
152       # networking_private_crypto_openssl.cc depends on boringssl.
153       deps += [ "//third_party/boringssl" ]
154     } else {
155       sources +=
156           rebase_path(gypi_values.chrome_common_networking_private_sources_nss,
157                       ".",
158                       "//chrome")
159     }
160   }
161   if (is_mac) {
162     sources +=
163         rebase_path(gypi_values.chrome_common_mac_sources, ".", "//chrome")
164     deps += [ ":app_mode_app_support" ]
165   }
167   if (enable_nacl) {
168     deps += [ "//components/nacl:nacl_common" ]
169   }
171   # Printing.
172   if (enable_basic_printing || enable_print_preview) {
173     deps += [
174       "//components/printing/common",
175       "//printing",
176     ]
177     if (enable_print_preview) {
178       # Full printing support.
179       sources += rebase_path(gypi_values.chrome_common_service_process_sources,
180                              ".",
181                              "//chrome")
182     }
183   }
185   if (enable_service_discovery) {
186     sources += [
187       "local_discovery/service_discovery_client.cc",
188       "local_discovery/service_discovery_client.h",
189     ]
190   }
191   if (enable_mdns) {
192     sources += [
193       "local_discovery/service_discovery_client_impl.cc",
194       "local_discovery/service_discovery_client_impl.h",
195     ]
196   }
198   if (is_android) {
199     sources -= [
200       "badge_util.cc",
201       "channel_info_posix.cc",
202       "icon_with_badge_image_source.cc",
203       "media_galleries/metadata_types.h",
204     ]
205   } else {
206     # Non-Android.
207     sources +=
208         rebase_path(gypi_values.chrome_common_importer_sources, ".", "//chrome")
209   }
211   if (is_chromeos) {
212     sources -= [ "channel_info_posix.cc" ]
213   }
215   if (is_win) {
216     deps += [
217       "//components/dom_distiller/core",  # Needed by chrome_content_client.cc.
218       "//third_party/wtl",
219     ]
220   }
222   if (enable_mdns) {
223     sources += [ "local_discovery/local_discovery_messages.h" ]
224   }
226   if (is_mac) {
227     sources -= [ "channel_info_posix.cc" ]
228     deps += [
229       "//third_party/mach_override",
230       "//third_party/google_toolbox_for_mac",
231     ]
232   }
234   if (enable_plugins) {
235     sources += [
236       "pepper_flash.cc",
237       "pepper_flash.h",
238       "ppapi_utils.cc",
239       "ppapi_utils.h",
240     ]
241     deps += [ "//third_party/adobe/flash:flapper_version_h" ]
242   }
243   if (enable_plugins && enable_extensions) {
244     sources += [
245       "pepper_permission_util.cc",
246       "pepper_permission_util.h",
247     ]
248   }
249   if (!enable_webrtc) {
250     sources -= [ "media/webrtc_logging_messages.h" ]
251   }
252   if (enable_configuration_policy) {
253     deps += [ "//components/policy" ]
254   }
256   if (safe_browsing_mode == 1) {
257     sources += rebase_path(gypi_values.chrome_common_full_safe_browsing_sources,
258                            ".",
259                            "//chrome")
260   }
263 # This target allows other targets to depend on result_codes.h which is a
264 # header-only dependency, without bringing in all of content.
265 source_set("result_codes") {
266   sources = [
267     "chrome_result_codes.h",
268   ]
271 process_version("make_chrome_version") {
272   template_file = "chrome_version.cc.version"
273   output = "$target_gen_dir/chrome_version.cc"
276 # GN version: chrome/common_constants.gyp:common_constants
277 static_library("constants") {
278   sources = [
279     "chrome_constants.cc",
280     "chrome_constants.h",
281     "chrome_icon_resources_win.cc",
282     "chrome_icon_resources_win.h",
283     "chrome_paths.cc",
284     "chrome_paths.h",
285     "chrome_paths_android.cc",
286     "chrome_paths_internal.h",
287     "chrome_paths_linux.cc",
288     "chrome_paths_mac.mm",
289     "chrome_paths_win.cc",
290     "chrome_switches.cc",
291     "chrome_switches.h",
292     "env_vars.cc",
293     "env_vars.h",
294     "pref_font_script_names-inl.h",
295     "pref_font_webkit_names.h",
296     "pref_names.cc",
297     "pref_names.h",
298     "widevine_cdm_constants.cc",
299     "widevine_cdm_constants.h",
300   ]
302   deps = [
303     ":make_chrome_version",
304     "//base",
305     "//base/third_party/dynamic_annotations",
306     "//components/bookmarks/common",
307     "//third_party/widevine/cdm:version_h",
308   ]
310   if (enable_nacl) {
311     deps += [ "//components/nacl:nacl_switches" ]
312   }
315 source_set("test_support") {
316   testonly = true
317   visibility = [ "//chrome/test:test_support" ]
319   sources = []
321   deps = [
322     ":common",
323     "//base",
324     "//testing/gtest",
325   ]
327   if (is_win || is_mac) {
328     sources += [
329       "media_galleries/picasa_test_util.cc",
330       "media_galleries/picasa_test_util.h",
331       "media_galleries/pmp_test_util.cc",
332       "media_galleries/pmp_test_util.h",
333     ]
334   }
336   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
338   if (enable_extensions) {
339     sources += [
340       "extensions/extension_test_util.cc",
341       "extensions/extension_test_util.h",
342     ]
343   }
346 # GN version: chrome/chrome.gyp:app_mode_app_support
347 static_library("app_mode_app_support") {
348   sources = [
349     "mac/app_mode_chrome_locator.h",
350     "mac/app_mode_chrome_locator.mm",
351     "mac/app_mode_common.h",
352     "mac/app_mode_common.mm",
353   ]
355   deps = [
356     ":constants",
357     "//base",
358   ]
361 mojom("mojo_bindings") {
362   sources = [
363     "resource_usage_reporter.mojom",
364   ]