Revert of Refactoring of Cast-related crypto code (patchset #19 id:350001 of https...
[chromium-blink-merge.git] / chrome / common / BUILD.gn
blob2375ffe90403f3c4e50a8a444b07d1fe4308e368
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/printing/common:printing_common",
63     "//components/translate/core/common",
64     "//components/variations",
65     "//content/public/common",
66     "//crypto",
67     "//extensions/common:common_constants",
68     "//media/cast:net",
69     "//net",
70     "//skia",
71     "//third_party/icu",
72     "//third_party/libxml",
73     "//third_party/sqlite",
74     "//third_party/zlib:zip",
75     "//ui/resources:resources",
76     "//url",
77   ]
79   if (is_ios) {
80     sources += [
81       # Use this Mac file that was filtered out.
82       "chrome_version_info_mac.mm",
83     ]
84   } else {
85     # Non-iOS.
86     deps += [
87       "//components/visitedlink/common",
88       "//components/autofill/content/common",
89       "//components/autofill/core/common",
90       "//components/password_manager/content/common",
91       "//components/password_manager/core/common",
92       "//components/signin/core/common",
93       "//components/translate/content/common",
94       "//ipc",
95       "//third_party/re2",
96       "//third_party/widevine/cdm:version_h",
97     ]
98   }
100   if (enable_extensions) {
101     sources += rebase_path(gypi_values.chrome_common_extensions_sources,
102                            ".",
103                            "//chrome")
104     deps += [
105       "//device/usb",
106       "//chrome/common/extensions/api",
107       "//extensions/common",
108       "//extensions/common/api",
109       "//extensions:extensions_resources",
110       "//extensions/strings",
111     ]
112   }
114   if (is_win || is_mac) {
115     sources +=
116         rebase_path(gypi_values.chrome_common_win_mac_sources, ".", "//chrome")
117     if (use_openssl) {
118       sources -= [ "extensions/api/networking_private/networking_private_crypto_nss.cc" ]
120       # networking_private_crypto_openssl.cc depends on boringssl.
121       deps += [ "//third_party/boringssl" ]
122     } else {
123       sources -= [ "extensions/api/networking_private/networking_private_crypto_openssl.cc" ]
124     }
125     deps += [ "//breakpad:client" ]
126   }
127   if (is_mac) {
128     sources +=
129         rebase_path(gypi_values.chrome_common_mac_sources, ".", "//chrome")
130   }
132   if (enable_nacl) {
133     deps += [
134       #'<(DEPTH)/components/nacl.gyp:nacl_common',  TODO(GYP)
135     ]
136   }
138   # Printing.
139   if (!enable_basic_printing && !enable_print_preview) {
140     sources -= [
141       "print_messages.cc",
142       "print_messages.h",
143     ]
144   } else {
145     deps += [ "//printing" ]
146     if (enable_print_preview) {
147       # Full printing support.
148       sources += rebase_path(gypi_values.chrome_common_service_process_sources,
149                              ".",
150                              "//chrome")
151     }
152   }
154   if (enable_service_discovery) {
155     sources += [
156       "local_discovery/service_discovery_client.cc",
157       "local_discovery/service_discovery_client.h",
158     ]
159   }
160   if (enable_mdns) {
161     sources += [
162       "local_discovery/service_discovery_client_impl.cc",
163       "local_discovery/service_discovery_client_impl.h",
164     ]
165   }
167   if (is_android) {
168     sources -= [
169       "badge_util.cc",
170       "chrome_version_info_posix.cc",
171       "icon_with_badge_image_source.cc",
172       "media_galleries/metadata_types.h",
173       "spellcheck_common.cc",
174     ]
175   } else {
176     # Non-Android.
177     sources +=
178         rebase_path(gypi_values.chrome_common_importer_sources, ".", "//chrome")
179   }
181   if (is_chromeos) {
182     sources -= [ "chrome_version_info_posix.cc" ]
183   }
185   if (is_win) {
186     deps += [ "//third_party/wtl" ]
187   }
189   if (enable_mdns) {
190     sources += [ "local_discovery/local_discovery_messages.h" ]
191   }
193   if (is_mac) {
194     sources -= [ "chrome_version_info_posix.cc" ]
195     deps += [
196       "//third_party/mach_override",
197       "//third_party/google_toolbox_for_mac",
198     ]
199   }
201   if (enable_plugins) {
202     sources += [
203       "pepper_flash.cc",
204       "pepper_flash.h",
205       "pepper_permission_util.cc",
206       "pepper_permission_util.h",
207     ]
208     deps += [ "//third_party/adobe/flash:flapper_version_h" ]
209   }
210   if (!enable_webrtc) {
211     sources -= [ "media/webrtc_logging_messages.h" ]
212   }
213   if (enable_configuration_policy) {
214     deps += [ "//components/policy" ]
215   }
217   if (safe_browsing_mode == 1) {
218     defines += [ "FULL_SAFE_BROWSING" ]
219     sources += rebase_path(gypi_values.chrome_common_full_safe_browsing_sources,
220                            ".",
221                            "//chrome")
222   }
223   if (safe_browsing_mode == 2) {
224     defines += [ "MOBILE_SAFE_BROWSING" ]
225   }
228 import("//chrome/version.gni")
229 process_version("version") {
230   visibility = [ ":common" ]
231   source = "chrome_version_info_values.h.version"
232   output = "$target_gen_dir/chrome_version_info_values.h"
235 # GN version: chrome/common_constants.gyp:common_constants
236 static_library("constants") {
237   sources = [
238     "chrome_constants.cc",
239     "chrome_constants.h",
240     "chrome_icon_resources_win.cc",
241     "chrome_icon_resources_win.h",
242     "chrome_paths.cc",
243     "chrome_paths.h",
244     "chrome_paths_android.cc",
245     "chrome_paths_internal.h",
246     "chrome_paths_linux.cc",
247     "chrome_paths_mac.mm",
248     "chrome_paths_win.cc",
249     "chrome_switches.cc",
250     "chrome_switches.h",
251     "env_vars.cc",
252     "env_vars.h",
253     "net/test_server_locations.cc",
254     "net/test_server_locations.h",
255     "pref_font_script_names-inl.h",
256     "pref_font_webkit_names.h",
257     "pref_names.cc",
258     "pref_names.h",
259     "widevine_cdm_constants.cc",
260     "widevine_cdm_constants.h",
261   ]
263   deps = [
264     "//base",
265     "//base/third_party/dynamic_annotations",
266     "//components/bookmarks/common",
267     "//third_party/widevine/cdm:version_h",
268   ]
270   if (enable_nacl) {
271     deps += [
272       #'../components/nacl.gyp:nacl_switches',  TODO(GYP)
273     ]
274   }
277 source_set("test_support") {
278   testonly = true
279   visibility = [ "//chrome/test:test_support" ]
281   sources = []
283   deps = [
284     ":common",
285     "//base",
286     "//testing/gtest",
287   ]
289   if (is_win || is_mac) {
290     sources += [
291       "media_galleries/picasa_test_util.cc",
292       "media_galleries/picasa_test_util.h",
293       "media_galleries/pmp_test_util.cc",
294       "media_galleries/pmp_test_util.h",
295     ]
296   }
298   if (enable_extensions) {
299     sources += [
300       "extensions/extension_test_util.cc",
301       "extensions/extension_test_util.h",
302     ]
303   }