Roll src/third_party/WebKit 116cf7f:79abaa8 (svn 189234:189235)
[chromium-blink-merge.git] / chrome / common / BUILD.gn
blob52de37394fe14f77a75be5da6e7c95cba0bd5049
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")
7 gypi_values = exec_script("//build/gypi_to_gn.py",
8                           [ rebase_path("../chrome_common.gypi") ],
9                           "scope",
10                           [ "../chrome_common.gypi" ])
12 # GYP version: chrome/chrome_resources.gyp:chrome_resources
13 #              (generate_common_resources action)
14 grit("resources") {
15   source = "common_resources.grd"
16   output_dir = "$root_gen_dir/chrome"
17   output_name = "common_resources"
18   outputs = [
19     "grit/common_resources.h",
20     "common_resources.pak",
21   ]
24 # GYP version: chrome/chrome_resources.gyp:chrome_resources
25 #              (generate_extensions_api_resources action)
26 if (enable_extensions) {
27   grit("extensions_api_resources") {
28     source = "extensions_api_resources.grd"
29     output_dir = "$root_gen_dir/chrome"
30     outputs = [
31       "grit/extensions_api_resources.h",
32       "extensions_api_resources.pak",
33     ]
34   }
37 # GYP version: chrome/chrome_common.gyp:common
38 static_library("common") {
39   sources = rebase_path(gypi_values.chrome_common_sources, ".", "//chrome")
40   defines = []
42   configs += [ "//build/config/compiler:wexit_time_destructors" ]
44   deps = [
45     ":version",
46     "//base:base",
47     "//base:i18n",
48     "//base:prefs",
49     "//base:base_static",
50     "//chrome:resources",
51     "//chrome:strings",
52     "//chrome/app/theme:theme_resources",
53     "//chrome/common:constants",
54     "//chrome/common/net",
55     "//chrome/common/safe_browsing:proto",
56     "//chrome/installer/util",
57     "//components/cloud_devices/common",
58     "//components/content_settings/core/common",
59     "//components/json_schema",
60     "//components/metrics",
61     "//components/policy:policy_component_common",
62     "//components/translate/core/common",
63     "//components/variations",
64     "//content/public/common",
65     "//crypto",
66     "//extensions/common:common_constants",
67     "//net",
68     "//skia",
69     "//third_party/icu",
70     "//third_party/libxml",
71     "//third_party/sqlite",
72     "//third_party/zlib:zip",
73     "//ui/resources:resources",
74     "//url",
75   ]
77   if (is_ios) {
78     sources += [
79       # Use this Mac file that was filtered out.
80       "chrome_version_info_mac.mm",
81     ]
82   } else {
83     # Non-iOS.
84     deps += [
85       "//components/visitedlink/common",
86       "//components/autofill/content/common",
87       "//components/autofill/core/common",
88       "//components/password_manager/content/common",
89       "//components/password_manager/core/common",
90       "//components/signin/core/common",
91       "//components/translate/content/common",
92       "//ipc",
93       "//third_party/re2",
94       "//third_party/widevine/cdm:version_h",
95     ]
96   }
98   if (enable_extensions) {
99     sources += rebase_path(gypi_values.chrome_common_extensions_sources,
100                            ".",
101                            "//chrome")
102     deps += [
103       "//device/usb",
104       "//chrome/common/extensions/api",
105       "//extensions/common",
106       "//extensions/common/api",
107       "//extensions:extensions_resources",
108       "//extensions/strings",
109       "//media/cast:net",
110     ]
111   }
113   if (is_win || is_mac) {
114     sources +=
115         rebase_path(gypi_values.chrome_common_win_mac_sources, ".", "//chrome")
116     deps += [ "//breakpad:client" ]
117   }
118   if (is_win || is_mac || is_chromeos) {
119     if (use_openssl) {
120       sources += rebase_path(
121               gypi_values.chrome_common_networking_private_sources_openssl,
122               ".",
123               "//chrome")
125       # networking_private_crypto_openssl.cc depends on boringssl.
126       deps += [ "//third_party/boringssl" ]
127     } else {
128       sources +=
129           rebase_path(gypi_values.chrome_common_networking_private_sources_nss,
130                       ".",
131                       "//chrome")
132     }
133   }
134   if (is_mac) {
135     sources +=
136         rebase_path(gypi_values.chrome_common_mac_sources, ".", "//chrome")
137   }
139   if (enable_nacl) {
140     deps += [
141       #'<(DEPTH)/components/nacl.gyp:nacl_common',  TODO(GYP)
142     ]
143   }
145   # Printing.
146   if (enable_basic_printing || enable_print_preview) {
147     deps += [
148       "//components/printing/common:printing_common",
149       "//printing",
150     ]
151     if (enable_print_preview) {
152       # Full printing support.
153       sources += rebase_path(gypi_values.chrome_common_service_process_sources,
154                              ".",
155                              "//chrome")
156     }
157   }
159   if (enable_service_discovery) {
160     sources += [
161       "local_discovery/service_discovery_client.cc",
162       "local_discovery/service_discovery_client.h",
163     ]
164   }
165   if (enable_mdns) {
166     sources += [
167       "local_discovery/service_discovery_client_impl.cc",
168       "local_discovery/service_discovery_client_impl.h",
169     ]
170   }
172   if (is_android) {
173     sources -= [
174       "badge_util.cc",
175       "chrome_version_info_posix.cc",
176       "icon_with_badge_image_source.cc",
177       "media_galleries/metadata_types.h",
178       "spellcheck_common.cc",
179     ]
180   } else {
181     # Non-Android.
182     sources +=
183         rebase_path(gypi_values.chrome_common_importer_sources, ".", "//chrome")
184   }
186   if (is_chromeos) {
187     sources -= [ "chrome_version_info_posix.cc" ]
188   }
190   if (is_win) {
191     deps += [ "//third_party/wtl" ]
192   }
194   if (enable_mdns) {
195     sources += [ "local_discovery/local_discovery_messages.h" ]
196   }
198   if (is_mac) {
199     sources -= [ "chrome_version_info_posix.cc" ]
200     deps += [
201       "//third_party/mach_override",
202       "//third_party/google_toolbox_for_mac",
203     ]
204   }
206   if (enable_plugins) {
207     sources += [
208       "pepper_flash.cc",
209       "pepper_flash.h",
210       "pepper_permission_util.cc",
211       "pepper_permission_util.h",
212     ]
213     deps += [ "//third_party/adobe/flash:flapper_version_h" ]
214   }
215   if (!enable_webrtc) {
216     sources -= [ "media/webrtc_logging_messages.h" ]
217   }
218   if (enable_configuration_policy) {
219     deps += [ "//components/policy" ]
220   }
222   if (safe_browsing_mode == 1) {
223     defines += [ "FULL_SAFE_BROWSING" ]
224     sources += rebase_path(gypi_values.chrome_common_full_safe_browsing_sources,
225                            ".",
226                            "//chrome")
227   }
228   if (safe_browsing_mode == 2) {
229     defines += [ "MOBILE_SAFE_BROWSING" ]
230   }
233 import("//chrome/version.gni")
234 process_version("version") {
235   visibility = [ ":common" ]
236   source = "chrome_version_info_values.h.version"
237   output = "$target_gen_dir/chrome_version_info_values.h"
240 process_version("make_chrome_version") {
241   source = "chrome_version.cc.version"
242   output = "$target_gen_dir/chrome_version.cc"
245 # GN version: chrome/common_constants.gyp:common_constants
246 static_library("constants") {
247   sources = [
248     "chrome_constants.cc",
249     "chrome_constants.h",
250     "chrome_icon_resources_win.cc",
251     "chrome_icon_resources_win.h",
252     "chrome_paths.cc",
253     "chrome_paths.h",
254     "chrome_paths_android.cc",
255     "chrome_paths_internal.h",
256     "chrome_paths_linux.cc",
257     "chrome_paths_mac.mm",
258     "chrome_paths_win.cc",
259     "chrome_switches.cc",
260     "chrome_switches.h",
261     "env_vars.cc",
262     "env_vars.h",
263     "net/test_server_locations.cc",
264     "net/test_server_locations.h",
265     "pref_font_script_names-inl.h",
266     "pref_font_webkit_names.h",
267     "pref_names.cc",
268     "pref_names.h",
269     "widevine_cdm_constants.cc",
270     "widevine_cdm_constants.h",
271   ]
272   sources += get_target_outputs(":make_chrome_version")
274   deps = [
275     ":make_chrome_version",
276     "//base",
277     "//base/third_party/dynamic_annotations",
278     "//components/bookmarks/common",
279     "//third_party/widevine/cdm:version_h",
280   ]
282   if (enable_nacl) {
283     deps += [
284       #'../components/nacl.gyp:nacl_switches',  TODO(GYP)
285     ]
286   }
289 source_set("test_support") {
290   testonly = true
291   visibility = [ "//chrome/test:test_support" ]
293   sources = []
295   deps = [
296     ":common",
297     "//base",
298     "//testing/gtest",
299   ]
301   if (is_win || is_mac) {
302     sources += [
303       "media_galleries/picasa_test_util.cc",
304       "media_galleries/picasa_test_util.h",
305       "media_galleries/pmp_test_util.cc",
306       "media_galleries/pmp_test_util.h",
307     ]
308   }
310   if (enable_extensions) {
311     sources += [
312       "extensions/extension_test_util.cc",
313       "extensions/extension_test_util.h",
314     ]
315   }