Add more isolate/swarming support for GN builds.
[chromium-blink-merge.git] / components / BUILD.gn
blobdc82d950fbb7a51520966ff60c28a79000e7704d
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")
6 import("//build/config/ui.gni")
7 import("//testing/test.gni")
8 import("//tools/grit/repack.gni")
10 # Collection of all components. You wouldn't link to this, but this is rather
11 # to reference the files so they can be compiled by the build system.
12 group("all_components") {
13   testonly = true  # You shouldn't actually link to this.
14   visibility = [ "//:*" ]  # Only for the root targets to bring in.
16   deps = [
17     "//components/auto_login_parser",
18     "//components/autofill/content/browser",
19     "//components/autofill/content/common",
20     "//components/autofill/content/renderer",
21     "//components/bookmarks/browser",
22     "//components/bookmarks/common",
23     "//components/bookmarks/managed",
24     "//components/bookmarks/test",
25     "//components/captive_portal",
26     "//components/cdm/browser",
27     "//components/cdm/common",
28     "//components/cdm/renderer",
29     "//components/cloud_devices/common",
30     "//components/chrome_apps",
31     "//components/component_updater",
32     "//components/content_settings/core/browser",
33     "//components/content_settings/core/common",
34     "//components/crash/app",
35     "//components/crash/browser",
36     "//components/crx_file",
37     "//components/data_reduction_proxy/core/browser",
38     "//components/data_reduction_proxy/core/common",
39     "//components/device_event_log",
40     "//components/devtools_discovery",
41     "//components/devtools_http_handler",
42     "//components/dom_distiller/core",
43     "//components/domain_reliability",
44     "//components/enhanced_bookmarks",
45     "//components/favicon/core",
46     "//components/favicon_base",
47     "//components/feedback",
48     "//components/gcm_driver",
49     "//components/gcm_driver/crypto",
50     "//components/gcm_driver/instance_id",
51     "//components/google/core/browser",
52     "//components/history/content/browser",
53     "//components/history/core/browser",
54     "//components/history/core/common",
55     "//components/history/core/test",
56     "//components/infobars/core",
57     "//components/invalidation/impl",
58     "//components/json_schema",
59     "//components/keyed_service/content",
60     "//components/language_usage_metrics",
61     "//components/leveldb_proto",
62     "//components/login",
63     "//components/metrics",
64     "//components/mime_util",
65     "//components/navigation_interception",
66     "//components/navigation_metrics",
67     "//components/network_time",
68     "//components/offline_pages",
69     "//components/omnibox/browser",
70     "//components/onc",
71     "//components/os_crypt",
72     "//components/packed_ct_ev_whitelist",
73     "//components/pairing",
74     "//components/password_manager/content/browser",
75     "//components/password_manager/core/browser",
76     "//components/password_manager/core/common",
77     "//components/pdf/browser",
78     "//components/pdf/common",
79     "//components/pdf/renderer",
80     "//components/plugins/common",
81     "//components/plugins/renderer",
82     "//components/policy",
83     "//components/power",
84     "//components/precache/core",
85     "//components/precache/content",
86     "//components/proxy_config",
87     "//components/pref_registry",
88     "//components/query_parser",
89     "//components/rappor",
90     "//components/renderer_context_menu",
91     "//components/resources:components_resources",
92     "//components/search",
93     "//components/search_engines",
94     "//components/search_provider_logos",
95     "//components/secure_display",
96     "//components/sessions",
97     "//components/signin/core/browser",
98     "//components/startup_metric_utils",
99     "//components/strings",
100     "//components/sync_driver",
101     "//components/tracing",
102     "//components/tracing:startup_tracing",
103     "//components/translate/content/browser",
104     "//components/translate/content/common",
105     "//components/translate/content/renderer",
106     "//components/translate/core/browser",
107     "//components/translate/core/common",
108     "//components/ui/zoom:ui_zoom",
109     "//components/undo",
110     "//components/update_client",
111     "//components/url_fixer",
112     "//components/url_matcher",
113     "//components/user_manager",
114     "//components/user_prefs",
115     "//components/variations",
116     "//components/visitedlink/browser",
117     "//components/visitedlink/common",
118     "//components/visitedlink/renderer",
119     "//components/wallpaper",
120     "//components/web_cache/browser",
121     "//components/web_cache/common",
122     "//components/web_cache/renderer",
123     "//components/web_modal",
124     "//components/web_resource",
125     "//components/webcrypto",
126     "//components/webdata/common",
127     "//components/wifi",
128     "//components/wifi_sync",
129   ]
131   if (!is_android) {
132     # TODO(agrieve): Add to main deps list once compile errors are resolved.
133     deps += [ "//components/devtools_service" ]
134   }
136   if (!is_android && !is_ios) {
137     deps += [
138       "//components/proximity_auth",
139       "//components/proximity_auth/cryptauth",
140     ]
141   }
143   if (!enable_configuration_policy) {
144     deps -= [ "//components/policy" ]
145   }
147   if (!is_win && !is_mac) {
148     deps -= [ "//components/wifi" ]
149   }
150   if (!is_chromeos) {
151     deps -= [
152       "//components/pairing",
153       "//components/wifi_sync",
154     ]
155   }
157   if (!is_chromeos || !enable_extensions) {
158     deps -= [ "//components/chrome_apps" ]
159   }
161   if (is_ios) {
162     deps -= [
163       "//components/history/content/browser",
164       "//components/keyed_service/content",
165     ]
166   }
168   if (!enable_plugins) {
169     deps -= [
170       "//components/pdf/browser",
171       "//components/pdf/common",
172       "//components/pdf/renderer",
173     ]
174   }
176   if (is_android) {
177     deps -= [
178       "//components/autofill/content/browser",  # Blocked on content/blink.
179       "//components/autofill/content/common",  # Blocked on content.
180       "//components/autofill/content/renderer",  # Blocked on content/blink.
181       "//components/crash/app",  # Should work, needs checking.
182       "//components/crash/browser",  # Should work, needs checking.
183       "//components/captive_portal",  # Should work, needs checking.
184       "//components/cloud_devices/common",  # Should work, needs checking.
185       "//components/cdm/browser",  # Blocked on content.
186       "//components/cdm/common",  # Blocked on content.
187       "//components/cdm/renderer",  # Blocked on content.
188       "//components/data_reduction_proxy/core/browser",  # Should work, needs checking.
189       "//components/data_reduction_proxy/core/common",  # Should work, needs checking.
190       "//components/dom_distiller/core",  # Blocked on content.
191       "//components/domain_reliability",  # Blocked on content.
192       "//components/favicon/core",  # Blocked on keyed service.
193       "//components/favicon_base",  # Should work, needs checking.
194       "//components/feedback",  # Blocked on content.
195       "//components/google/core/browser",  # Should work, needs checking.
196       "//components/history/core/browser",  # Should work, needs checking.
197       "//components/history/core/common",  # Should work, needs checking.
198       "//components/history/core/test",  # Should work, needs checking.
199       "//components/infobars/core",  # Should work, needs checking.
200       "//components/invalidation/impl",  # Should work, needs checking.
201       "//components/json_schema",  # Should work, needs checking.
202       "//components/keyed_service/content",  # Blocked on content.
203       "//components/navigation_interception",  # Blocked on content.
204       "//components/omnibox/browser",  # Should work, needs checking.
205       "//components/password_manager/content/browser",  # Blocked on content.
206       "//components/password_manager/core/browser",  # Should work, needs checking.
207       "//components/password_manager/core/common",  # Should work, needs checking.
208       "//components/plugins/renderer",  # Blocked on blink.
209       "//components/power",  # Blocked on content.
210       "//components/policy",  # Blocked on content (indirectly via autofill).
211       "//components/precache/content",  # Blocked on content.
212       "//components/precache/core",  # Should work, needs checking.
213       "//components/rappor",  # Should work, needs checking.
214       "//components/renderer_context_menu",  # Blocked on content.
215       "//components/search_engines",  # Should work, needs checking.
216       "//components/search_provider_logos",  # Should work, needs checking.
217       "//components/sessions",  # Blocked on content.
218       "//components/signin/core/browser",  # Should work, needs checking.
219       "//components/translate/content/browser",  # Blocked on content.
220       "//components/translate/content/common",  # Blocked on content.
221       "//components/translate/content/renderer",  # Blocked on content.
222       "//components/user_prefs",  # Blocked on content.
223       "//components/visitedlink/browser",  # Blocked on content.
224       "//components/visitedlink/common",  # Blocked on content.
225       "//components/visitedlink/renderer",  # Blocked on blink
226       "//components/web_cache/browser",  # Blocked on content and blink.
227       "//components/web_cache/renderer",  # Blocked on content and blink.
228       "//components/web_modal",  # Blocked on content.
229     ]
230   }
232   if (!is_ios && !is_android) {
233     deps += [
234       "//components/copresence",
235       "//components/storage_monitor",
236     ]
237   }
239   if (!is_ios) {
240     deps += [
241       "//components/app_modal",
242       "//components/browsing_data",
243       "//components/guest_view/browser",
244       "//components/guest_view/common",
245       "//components/guest_view/renderer",
246       "//components/safe_json",
247       "//components/scheduler",
248       "//components/test_runner",
249     ]
250   }
252   if (toolkit_views) {
253     deps += [ "//components/constrained_window" ]
254   }
257 # TODO(GYP): Delete this after we've converted everything to GN.
258 # The _run targets exist only for compatibility w/ GYP.
259 group("components_unittests_run") {
260   testonly = true
261   deps = [
262     ":components_unittests",
263   ]
266 # To add a unit test to this target, make a "unit_test" source_set in your
267 # component (it's important to use a source_set instead of a static library or
268 # no tests will run) and add a reference here. You can add more than one unit
269 # test target if convenient.
270 test("components_unittests") {
271   sources = [
272     "test/run_all_unittests.cc",
273   ]
275   if (is_android || is_linux || is_mac || is_win) {
276     data = [
277       "test/data/",
279       # TODO(dpranke): Remove the next two lines after GN has rolled to 339778.
280       "$root_out_dir/components_tests_resources.pak",
281       "$root_out_dir/ui_test.pak",
282     ]
283   }
285   # Add only ":unit_tests" dependencies here. If your tests have dependencies
286   # (this would at least include the component itself), they should be on the
287   # test source set and not here.
288   deps = [
289     "//components/auto_login_parser:unit_tests",
290     "//components/autofill/content/browser:unit_tests",
291     "//components/autofill/core/browser:unit_tests",
292     "//components/autofill/core/common:unit_tests",
293     "//components/bookmarks/browser:unit_tests",
294     "//components/bookmarks/managed:unit_tests",
295     "//components/captive_portal:unit_tests",
296     "//components/cloud_devices/common:unit_tests",
297     "//components/component_updater:unit_tests",
298     "//components/content_settings/core/browser:unit_tests",
299     "//components/content_settings/core/common:unit_tests",
300     "//components/crx_file:unit_tests",
301     "//components/data_reduction_proxy/content/browser:unit_tests",
302     "//components/data_reduction_proxy/core/browser:unit_tests",
303     "//components/data_reduction_proxy/core/common:unit_tests",
304     "//components/device_event_log:unit_tests",
305     "//components/devtools_http_handler:unit_tests",
306     "//components/dom_distiller/core:unit_tests",
307     "//components/domain_reliability:unit_tests",
308     "//components/favicon_base:unit_tests",
309     "//components/gcm_driver:unit_tests",
310     "//components/gcm_driver/crypto:unit_tests",
311     "//components/gcm_driver/instance_id:unit_tests",
312     "//components/google/core/browser:unit_tests",
313     "//components/invalidation/impl:unittests",
314     "//components/login:unit_tests",
315     "//components/metrics:unit_tests",
316     "//components/mime_util:unit_tests",
317     "//components/offline_pages:unit_tests",
318     "//components/omnibox/browser:unit_tests",
319     "//components/packed_ct_ev_whitelist:unit_tests",
320     "//components/undo:unit_tests",
321     "//components/secure_display:unit_tests",
322     "//components/update_client:unit_tests",
323     "//components/variations:unit_tests",
324     "//components/webcrypto:unit_tests",
325     "//components/web_resource:unit_tests",
326     "//components/webdata/common:unit_tests",
328     # These are the deps required by the code in this target.
329     "//base",
330     "//base/test:test_support",
331     "//content/test:test_support",
332     "//net",
333     "//ui/base",
334     "//ui/resources:ui_test_pak",
335   ]
337   data_deps = [
338     ":components_tests_pak",
339     "//third_party/mesa:osmesa",
340     "//ui/resources:ui_test_pak",
341   ]
343   if (enable_rlz_support) {
344     deps += [ "//components/rlz:unit_tests" ]
345   }
347   if (is_android) {
348     isolate_file = "components_unittests.isolate"
350     deps += [ "//content/public/android:content_java" ]
351     deps -= [
352       "//components/gcm_driver:unit_tests",
353       "//components/gcm_driver/instance_id:unit_tests",
354     ]
355   }
357   if (!is_android && !is_ios) {
358     deps += [ "//components/proximity_auth:unit_tests" ]
359   }
361   if (is_chromeos) {
362     deps += [ "//components/ownership:unit_tests" ]
363   }
365   # TODO(GYP) need this target.
366   #'breakpad/app/crash_keys_win_unittest.cc',
368   # Precache tests need these defines.
369   #configs += [ "//components/precache/core:precache_config" ]
371   if (toolkit_views) {
372     # TODO(GYP) enable this as above.
373     #deps += [ "//components/constrained_window:unit_tests" ]
374   }
375   if (is_win) {
376     deps += [ "//components/browser_watcher:unit_tests" ]
377   }
378   if (is_ios) {
379     deps -= [ "//components/devtools_http_handler:unit_tests" ]
380   }
382   if (!is_ios) {
383     deps += [
384       "//components/safe_json:unit_tests",
385       "//components/scheduler:unit_tests",
386     ]
387   }
390 repack("components_tests_pak") {
391   sources = [
392     "$root_gen_dir/components/components_resources.pak",
393     "$root_gen_dir/components/strings/components_strings_en-US.pak",
394   ]
396   output = "$root_out_dir/components_tests_resources.pak"
398   deps = [
399     "//components/resources",
400     "//components/strings",
401   ]
404 # TODO(GYP): Delete this after we've converted everything to GN.
405 # The _run targets exist only for compatibility w/ GYP.
406 group("components_browsertests_run") {
407   testonly = true
408   deps = [
409     ":components_browsertests",
410   ]
413 test("components_browsertests") {
414   sources = [
415     "autofill/content/browser/risk/fingerprint_browsertest.cc",
416     "autofill/content/renderer/password_form_conversion_utils_browsertest.cc",
417     "dom_distiller/content/browser/distillable_page_utils_browsertest.cc",
418     "dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc",
419     "password_manager/content/renderer/credential_manager_client_browsertest.cc",
420   ]
422   data = [
423     "$root_out_dir/components_tests_resources.pak",
424     "$root_out_dir/content_shell.pak",
425   ]
427   if (is_android || is_linux || is_mac || is_win) {
428     data += [
429       "test/data/",
430       "dom_distiller/core/javascript/",
431       "//third_party/dom_distiller_js/dist/test/data/",
432     ]
433   }
435   if (is_mac) {
436     data += [ "$root_out_dir/Content Shell.app/" ]
437   }
439   defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
441   deps = [
442     "autofill/content/browser",
443     "autofill/content/renderer",
444     "content_settings/core/common",
445     "dom_distiller/content:content_browser",
446     "dom_distiller/core",
447     "dom_distiller/core:test_support",
448     "password_manager/content/browser",
449     "password_manager/content/common",
450     "password_manager/content/renderer",
451     "strings",
452     "//base",
453     "//base/test:test_support",
454     "//content/test:browsertest_support",
455     "//content/test:test_support",
456     "//device/bluetooth",
457     "//testing/gmock",
458     "//testing/gtest",
459     "//ui/base",
460   ]
462   data_deps = [
463     ":components_tests_pak",
464     "//third_party/mesa:osmesa",
465   ]
467   if (is_android) {
468     sources += [ "test/android/browsertests_apk/components_browser_tests_jni_onload.cc" ]
469     sources -= [ "autofill/content/browser/risk/fingerprint_browsertest.cc" ]
470     deps += [ "//testing/android/native_test:native_test_support" ]
471     use_launcher = false
472     isolate_file = "components_browsertests.isolate"
473   }
475   if (is_linux) {
476     # content_extractor_browsertest is a standalone content extraction tool built as
477     # a MANUAL component_browsertest.
478     sources += [ "dom_distiller/standalone/content_extractor_browsertest.cc" ]
479     deps += [
480       "pref_registry:test_support",
481       "//base:prefs_test_support",
482     ]
483   }
486 test("components_perftests") {
487   sources = [
488     "scheduler/child/task_queue_manager_perftest.cc",
489     "visitedlink/test/visitedlink_perftest.cc",
490   ]
492   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
493   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
495   deps = [
496     "//base",
497     "//base/test:test_support_perf",
498     "//testing/gtest",
499     "//testing/perf",
500     "//content/test:test_support",
501     "//components/visitedlink/browser",
502   ]