BUILD.gn 32.7 KB
Newer Older
1 2 3 4
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

5 6 7 8 9
# This is the root build file for GN. GN will start processing by loading this
# file, and recursively load all dependencies until all dependencies are either
# resolved or known not to exist (which will cause the build to fail). So if
# you add a new build file, there must be some path of dependencies from this
# file to your new one or GN won't know about it.
10

11
import("//build/config/compiler/compiler.gni")
12
import("//build/config/features.gni")
13
import("//build/config/sanitizers/sanitizers.gni")
14
import("//build/config/ui.gni")
15
import("//extensions/features/features.gni")
16
import("//media/media_options.gni")
17
import("//remoting/remoting_enable.gni")
18
import("//third_party/openh264/openh264_args.gni")
19
import("//tools/ipc_fuzzer/ipc_fuzzer.gni")
20
import("//ui/ozone/ozone.gni")
21
import("//v8/gni/v8.gni")
22
import("//v8/snapshot_toolchain.gni")
23

24 25 26
if (is_android) {
  import("//build/config/android/config.gni")
}
27

28 29 30 31 32 33 34
declare_args() {
  # A list of extra dependencies to add to the root target. This allows a
  # checkout to add additional targets without explicitly changing any checked-
  # in files.
  root_extra_deps = []
}

35 36 37 38 39 40
if (is_official_build) {
  # An official (maximally optimized!) component (optimized for build times)
  # build doesn't make sense and usually doesn't work.
  assert(!is_component_build)
}

41
# This file defines the following three main targets:
42
#
43 44 45
# "gn_all" should (transitively) cause everything to be built; if you run
# 'ninja gn_all' and then 'ninja all', the second build should do no work.
#
46
# "gn_visibility": targets that are normally not visible to top-level targets,
47 48 49 50 51 52 53 54 55 56 57
# but are built anyway by "all". Since we don't want any such targets, we have
# this placeholder to make sure hidden targets that aren't otherwise depended
# on yet are accounted for.
#
# "All" is an alias for "gn_all". It exists for bot compatibility w/ GYP for
# the iOS bots and the official builders, but should not be generally used
# during the GYP->GN migration.  We cannot guarantee that GN's "All" builds the
# same set of targets as GYP's "All" does, because GYP's "All" supports
# wildcards.
#
# Lastly, none of these targets are guaranteed to be the same as what ninja
58 59
# will build with "all". For more on how "all" works and how GN determines
# "all", see crbug.com/503241.
60
#
61 62 63
# TODO(GYP_GONE): crbug.com/481694. Make sure that the above is true and there
# are scripts run on the bots that enforce this. Once the GYP migration is
# over, we can collapse all of these targets as desired.
64 65

group("gn_all") {
66 67
  testonly = true

68
  deps = [
69
    ":gn_visibility",
70
    "//base:base_unittests",
71
    "//chrome/installer",
72
    "//components:components_unittests",
sherouk's avatar
sherouk committed
73
    "//net:net_unittests",
sherouk's avatar
sherouk committed
74
    "//skia:skia_unittests",
75
    "//sql:sql_unittests",
ochang's avatar
ochang committed
76
    "//tools/ipc_fuzzer:ipc_fuzzer_all",
77
    "//tools/metrics:metrics_metadata",
sherouk's avatar
sherouk committed
78
    "//ui/base:ui_base_unittests",
79
    "//ui/gfx:gfx_unittests",
sherouk's avatar
sherouk committed
80
    "//url:url_unittests",
81
  ]
82

83 84 85 86 87 88 89
  if (!is_android && !is_chromecast) {
    deps += [
      "//crypto:crypto_unittests",
      "//google_apis/gcm:gcm_unit_tests",
    ]
  }

90
  if (!is_ios && !is_android && !is_chromecast) {
sherouk's avatar
sherouk committed
91 92 93 94 95 96
    deps += [
      "//chrome",
      "//chrome/test:browser_tests",
      "//chrome/test:interactive_ui_tests",
      "//chrome/test:sync_integration_tests",
      "//chrome/test/chromedriver:chromedriver_unittests",
97 98
      "//components/sync/tools:sync_client",
      "//components/sync/tools:sync_listen_notifications",
99 100
      "//extensions:extensions_browsertests",
      "//extensions:extensions_unittests",
101
      "//gpu/gles2_conform_support:gles2_conform_test",
102
      "//gpu/khronos_glcts_support:khronos_glcts_test",
sherouk's avatar
sherouk committed
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
      "//jingle:jingle_unittests",
      "//net:hpack_example_generator",
      "//ppapi:ppapi_unittests",
      "//ppapi/examples/2d",
      "//ppapi/examples/audio",
      "//ppapi/examples/audio_input",
      "//ppapi/examples/compositor",
      "//ppapi/examples/crxfs",
      "//ppapi/examples/enumerate_devices",
      "//ppapi/examples/file_chooser",
      "//ppapi/examples/flash_topmost",
      "//ppapi/examples/font",
      "//ppapi/examples/gamepad",
      "//ppapi/examples/gles2",
      "//ppapi/examples/gles2_spinning_cube",
      "//ppapi/examples/ime",
      "//ppapi/examples/input",
      "//ppapi/examples/media_stream_audio",
      "//ppapi/examples/media_stream_video",
      "//ppapi/examples/mouse_cursor",
      "//ppapi/examples/mouse_lock",
      "//ppapi/examples/printing",
      "//ppapi/examples/scaling",
      "//ppapi/examples/scripting",
      "//ppapi/examples/stub",
      "//ppapi/examples/threading",
      "//ppapi/examples/url_loader",
      "//ppapi/examples/video_capture",
      "//ppapi/examples/video_decode",
      "//ppapi/examples/video_effects",
      "//ppapi/examples/video_encode",
      "//printing:printing_unittests",
      "//third_party/cacheinvalidation:cacheinvalidation_unittests",
136
      "//third_party/pdfium/samples:pdfium_test",
137
      "//third_party/webrtc/tools:frame_analyzer",
138
      "//tools/battor_agent",
139
      "//tools/battor_agent:battor_agent_unittests",
140
      "//tools/gn",
141
      "//tools/gn:gn_unittests",
142
      "//tools/perf/clear_system_cache",
143
      "//tools/traffic_annotation/auditor:traffic_annotation_auditor",
144
      "//ui/accessibility:accessibility_unittests",
145
      "//ui/accessibility/extensions",
146 147 148 149 150 151
    ]
  }

  if (!is_ios) {
    deps += [
      "//cc:cc_unittests",
152
      "//chrome/test:telemetry_perf_unittests",
153 154
      "//chrome/test:unit_tests",
      "//components:components_browsertests",
155
      "//components/policy:policy_templates",
156 157 158 159 160 161
      "//content/shell:content_shell",
      "//content/test:content_browsertests",
      "//content/test:content_perftests",
      "//content/test:content_unittests",
      "//device:device_unittests",
      "//gpu:gpu_unittests",
162
      "//gpu/ipc/service:gpu_ipc_service_unittests",
163 164
      "//ipc:ipc_tests",
      "//media:media_unittests",
165
      "//media/capture:capture_unittests",
166
      "//media/cast:cast_unittests",
167 168 169
      "//media/midi:midi_unittests",
      "//mojo",
      "//mojo/common:mojo_common_unittests",
rockot's avatar
rockot committed
170 171 172
      "//mojo/edk/system:mojo_system_unittests",
      "//mojo/edk/test:mojo_public_bindings_unittests",
      "//mojo/edk/test:mojo_public_system_unittests",
173
      "//net:net_perftests",
174
      "//services/service_manager/public/cpp",
175
      "//storage:storage_unittests",
176
      "//third_party/WebKit/Source/platform:blink_platform_unittests",
177
      "//third_party/WebKit/Source/platform/heap:blink_heap_unittests",
178
      "//third_party/WebKit/Source/platform/wtf:wtf_unittests",
179
      "//third_party/WebKit/Source/web:webkit_unit_tests",
180 181
      "//third_party/angle/src/tests:angle_end2end_tests",
      "//third_party/angle/src/tests:angle_unittests",
182
      "//third_party/angle/src/tests:angle_white_box_tests",
183
      "//third_party/catapult/telemetry:bitmaptools($host_toolchain)",
sherouk's avatar
sherouk committed
184 185 186 187 188
      "//third_party/smhasher:pmurhash",
      "//tools/imagediff($host_toolchain)",
      "//ui/display:display_unittests",
      "//ui/events:events_unittests",
      "//ui/gl:gl_unittests",
189
      "//ui/latency:latency_unittests",
sherouk's avatar
sherouk committed
190
      "//ui/touch_selection:ui_touch_selection_unittests",
191
      "//url/ipc:url_ipc_unittests",
sherouk's avatar
sherouk committed
192
    ]
193
  } else {
194
    deps += [ "//ios:all" ]
sherouk's avatar
sherouk committed
195
  }
196

197
  deps += root_extra_deps
198

199
  if (enable_extensions) {
200
    deps += [ "//extensions/shell:app_shell_unittests" ]
201 202
  }

203 204
  if (enable_remoting) {
    deps += [ "//remoting:remoting_all" ]
205 206
  }

207
  if (toolkit_views) {
208 209 210 211 212
    deps += [
      "//ui/views:views_unittests",
      "//ui/views/examples:views_examples_exe",
      "//ui/views/examples:views_examples_with_content_exe",
    ]
213 214
  }

215
  if (use_ash) {
216
    deps += [
217
      "//ash:ash_content_unittests",
218 219
      "//ash:ash_shell_with_content",
      "//ash:ash_unittests",
220 221 222 223 224
    ]
  }

  if (use_aura) {
    deps += [
225 226 227 228
      "//ui/aura:aura_unittests",
      "//ui/aura:demo",
      "//ui/wm:wm_unittests",
    ]
229 230
  }

231
  if (use_ozone) {
232 233 234 235 236
    deps += [
      "//ui/ozone",
      "//ui/ozone:ozone_unittests",
      "//ui/ozone/gl:ozone_gl_unittests",
    ]
237 238
  }

239 240 241 242
  if (use_x11 || ozone_platform_x11) {
    deps += [ "//tools/xdisplaycheck" ]
  }

243
  if (is_win) {
brettw's avatar
brettw committed
244 245 246 247
    deps += [
      "//chrome/installer/gcapi",
      "//chrome/tools/build/win/syzygy:chrome_dll_syzygy",
    ]
248 249
  }

thakis's avatar
thakis committed
250 251 252 253
  if (is_mac) {
    deps += [ "//chrome/installer/gcapi_mac:gcapi_example" ]
  }

254
  if (is_android) {
255
    deps += [
256
      "//base:base_junit_tests",
257
      "//base/android/linker:chromium_android_linker",
258
      "//build/android/gyp/test:hello_world",
pkotwicz's avatar
pkotwicz committed
259
      "//chrome/android/webapk/shell_apk:webapk",
260 261 262
      "//components/invalidation/impl:components_invalidation_impl_junit_tests",
      "//components/policy/android:components_policy_junit_tests",
      "//content/public/android:content_junit_tests",
263
      "//content/shell/android:content_shell_apk",
264
      "//media/gpu:video_decode_accelerator_unittest",
265
      "//net/android:net_junit_tests",
266
      "//testing/android/junit:junit_unit_tests",
267
      "//third_party/android_async_task:android_async_task_java",
268
      "//third_party/errorprone:chromium_errorprone",
269
      "//third_party/smhasher:murmurhash3",
270
      "//tools/android:android_tools",
271
      "//tools/android:memconsumer",
272
      "//tools/android:push_apps_to_background",
273 274
      "//tools/android/audio_focus_grabber:audio_focus_grabber_apk",
      "//tools/android/customtabs_benchmark:customtabs_benchmark_apk",
275
      "//tools/android/kerberos/SpnegoAuthenticator:spnego_authenticator_apk",
276
      "//tools/cygprofile:cygprofile_unittests",
277
      "//ui/android:ui_junit_tests",
278
    ]
279
    deps -= [
280
      "//net:net_perftests",
281
      "//url:url_unittests",
282
    ]
283

284 285
    if (!is_component_build) {
      deps += [
286
        "//components/cronet/android:cronet_package",
287
        "//components/cronet/android:cronet_perf_test_apk",
288 289 290 291 292 293 294 295
        "//components/cronet/android:cronet_sample_apk",
        "//components/cronet/android:cronet_sample_test_apk",
        "//components/cronet/android:cronet_test_apk",
        "//components/cronet/android:cronet_test_instrumentation_apk",
        "//components/cronet/android:cronet_unittests",
      ]
    }

296 297
    if (!is_chromecast) {
      deps += [
298
        "//android_webview",
299
        "//android_webview/test",
300
        "//android_webview/tools/automated_ui_tests:webview_ui_test_app",
301
        "//android_webview/tools/system_webview_shell",
302
        "//chrome/android:chrome_junit_tests",
303
        "//chrome/android:chrome_public_apk",
304 305
        "//chrome/android:chrome_public_test_apk",
        "//chrome/android:chrome_sync_shell_test_apk",
306
        "//chrome/test/chromedriver/test/webview_shell:chromedriver_webview_shell_apk",
307
        "//content/shell/android:content_shell_test_apk",
308
        "//third_party/custom_tabs_client:custom_tabs_client_example_apk",
309 310 311
      ]
    }

312
    if (target_cpu != "x64") {
313 314 315 316
      deps += [
        "//content/shell/android:chromium_linker_test_apk",
        "//third_party/android_platform:android_relocation_packer_unittests($host_toolchain)",
      ]
317 318
    }

319
    if (enable_chrome_android_internal) {
320
      deps += [ "//clank" ]
321
    }
322 323
  }

324
  if (is_linux || is_android) {
325
    deps += [
326
      "//breakpad:breakpad_unittests",
327
      "//breakpad:core-2-minidump",
328
      "//breakpad:generate_test_dump",
329 330 331 332
      "//breakpad:minidump-2-core",
    ]
  }

333 334 335
  if (is_chromeos) {
    deps += [
      "//chromeos:chromeos_unittests",
336
      "//chromeos/components:chromeos_components_unittests",
337
      "//components/session_manager/core",
338 339
      "//ui/app_list:app_list_unittests",
      "//ui/app_list/presenter:app_list_presenter_unittests",
340
      "//ui/arc:ui_arc_unittests",
341 342 343 344
      "//ui/chromeos:ui_chromeos_unittests",
    ]
  }

345 346 347 348 349 350 351 352
  if (is_chromeos || is_mac || is_win) {
    deps += [
      "//rlz:rlz_id",
      "//rlz:rlz_lib",
      "//rlz:rlz_unittests",
    ]
  }

353 354
  if (is_linux) {
    # The following are definitely linux-only.
355
    deps += [
356 357
      "//chrome:manpage",
      "//chrome:xdg_mime",
358 359 360 361
      "//net:disk_cache_memory_test",
      "//net:quic_client",
      "//net:quic_server",
      "//sandbox/linux:chrome_sandbox",
362
      "//sandbox/linux:sandbox_linux_unittests",
363
    ]
dnicoara's avatar
dnicoara committed
364

365 366 367 368 369 370 371
    if (use_dbus) {
      deps += [
        "//dbus:dbus_test_server",
        "//dbus:dbus_unittests",
      ]
    }

372 373 374 375
    if (is_chrome_branded && is_official_build) {
      # TODO(dpranke): add the linux_dump_symbols flag?
      deps += [ "//chrome:linux_symbols" ]
    }
376 377
  }

378 379 380 381
  if (is_ios || is_win || (is_linux && !is_chromeos)) {
    deps += [
      "//base:base_i18n_perftests",
      "//base:base_perftests",
382
      "//google_apis:google_apis_unittests",
383 384 385
    ]
  }

386 387
  if ((is_win || is_mac || is_linux) &&
      (target_cpu == "x86" || target_cpu == "x64")) {
388 389 390
    deps += [ "//third_party/swiftshader" ]
  }

391 392 393
  # TODO(GYP): Figure out which of these should (and can) build
  # for chromeos/ios.
  if (!is_chromeos && !is_ios) {
394 395
    deps += [
      "//base:build_utf8_validator_tables",
396
      "//base:check_example",
397
      "//cc:cc_perftests",
398
      "//cc/blink:cc_blink_unittests",
399
      "//components:components_perftests",
400
      "//components/sync:run_sync_testserver",
401 402 403 404
      "//device:device_unittests",
      "//gin:gin_shell",
      "//gin:gin_unittests",
      "//google_apis/gcm:mcs_probe",
405
      "//gpu:gl_tests",
406
      "//gpu:gpu_perftests",
407 408
      "//ipc:ipc_perftests",
      "//media:media_perftests",
409 410 411 412 413
      "//net:dump_cache",
      "//third_party/libphonenumber:libphonenumber_unittests",
      "//ui/compositor:compositor_unittests",
    ]

414 415 416 417 418 419 420 421 422 423
    if (!is_android) {
      deps += [
        "//chrome/test:load_library_perf_tests",
        "//chrome/test:sync_performance_tests",
        "//chrome/test/chromedriver:chromedriver",
        "//chrome/test/chromedriver:chromedriver_tests",
        "//courgette:courgette",
        "//courgette:courgette_fuzz",
        "//courgette:courgette_minimal_tool",
        "//courgette:courgette_unittests",
424 425
        "//media/cast:generate_barcode_video",
        "//media/cast:generate_timecode_audio",
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
        "//net:crash_cache",
        "//net:crl_set_dump",
        "//net:dns_fuzz_stub",
        "//net:gdig",
        "//net:get_server_time",
        "//net:net_watcher",  # TODO(GYP): This should be conditional on use_v8_in_net
        "//net:run_testserver",
        "//net:stress_cache",
        "//net:tld_cleanup",
        "//ppapi:pepper_hash_for_uma",
        "//ppapi:ppapi_perftests",
        "//third_party/leveldatabase:env_chromium_unittests",
        "//third_party/libaddressinput:libaddressinput_unittests",
      ]
    }
441

442 443 444 445
    if (enable_extensions) {
      deps += [ "//extensions/shell:app_shell" ]
    }

446
    if (enable_nacl) {
447
      deps += [ "//components/nacl/loader:nacl_loader_unittests" ]
448 449 450

      if (is_linux) {
        # TODO(dpranke): Figure out what platforms should actually have this.
451 452 453 454 455 456 457 458
        deps += [ "//components/nacl/loader:nacl_helper" ]

        if (enable_nacl_nonsfi) {
          deps += [
            "//components/nacl/loader:helper_nonsfi",
            "//components/nacl/loader:nacl_helper_nonsfi_unittests",
          ]
        }
459
      }
460 461
    }

462
    if (media_use_ffmpeg && !is_android) {
463 464
      deps += [ "//media:ffmpeg_regression_tests" ]
    }
465 466
  }

467
  if (is_android || (is_linux && !is_chromeos)) {
468
    deps += [
469 470 471 472
      "//breakpad:dump_syms($host_toolchain)",
      "//breakpad:microdump_stackwalk($host_toolchain)",
      "//breakpad:minidump_dump($host_toolchain)",
      "//breakpad:minidump_stackwalk($host_toolchain)",
473 474 475
      "//components/network_hints/browser",
      "//content/public/app:browser",
      "//content/public/app:child",
rockot's avatar
rockot committed
476
      "//mojo/edk/test:mojo_public_system_perftests",
477
      "//services/service_manager/public/cpp",
478 479 480
      "//testing/gmock:gmock_main",
    ]

481 482 483
    if (!is_android) {
      deps += [
        "//chrome/test:chrome_app_unittests",
484
        "//gpu/khronos_glcts_support:khronos_glcts_test",
485 486 487 488 489 490 491 492 493
        "//media/cast:cast_benchmarks",
        "//media/cast:tap_proxy",
        "//skia:filter_fuzz_stub",
        "//skia:image_operations_bench",
        "//third_party/sqlite:sqlite_shell",
        "//ui/keyboard:keyboard_unittests",
        "//ui/message_center:message_center_unittests",
        "//ui/snapshot:snapshot_unittests",
      ]
494

495 496 497
      if (!is_debug && !is_component_build) {
        deps += [ "//chrome/tools/service_discovery_sniffer" ]
      }
498 499 500
    }

    if (use_x11) {
501
      if (target_cpu != "arm") {
502
        deps += [ "//gpu/tools/compositor_model_bench" ]
503
      }
504 505 506 507
    }
  }

  if (is_mac) {
508
    deps += [
509 510
      "//breakpad:crash_inspector",
      "//breakpad:dump_syms",
511 512
      "//third_party/apple_sample_code",
      "//third_party/molokocacao",
513
    ]
514
    deps -= [
515 516
      # Mojo in GN contains some things which are never compiled in GYP on Mac,
      # so compilation fails on Mac. They need porting.
517
      "//mojo",
518
    ]
519 520 521 522 523
  }

  if (is_win) {
    deps += [
      "//base:pe_image_test",
524
      "//chrome/install_static:install_static_unittests",
grt's avatar
grt committed
525
      "//chrome/installer/setup:setup_unittests",
526 527
      "//chrome_elf:chrome_elf_unittests",
      "//chrome_elf:dll_hash_main",
528
      "//cloud_print:cloud_print_unittests",
529 530 531 532 533 534 535 536 537 538
      "//components/wifi:wifi_test",
      "//net:quic_client",
      "//net:quic_server",
      "//sandbox/win:pocdll",
      "//sandbox/win:sandbox_poc",
      "//sandbox/win:sbox_integration_tests",
      "//sandbox/win:sbox_unittests",
      "//sandbox/win:sbox_validation_tests",
      "//testing/gtest:gtest_main",
      "//third_party/pdfium/samples:pdfium_diff",
539
      "//third_party/tcmalloc:addr2line-pdb",
540
      "//tools/win/chromeexts:chromeexts",
541
    ]
542 543 544 545 546

    if (!(is_component_build && is_debug && target_cpu == "x86")) {
      deps +=
          [ "//chrome/installer/mini_installer:next_version_mini_installer" ]
    }
sherouk's avatar
sherouk committed
547
  } else if (!is_android && !is_ios) {
548
    deps += [ "//breakpad:symupload($host_toolchain)" ]
549
  }
550

551 552 553
  if (is_chromecast) {
    deps += [ "//chromecast:cast_shell" ]
  }
554

555 556 557 558 559 560 561
  if (is_mac || is_win) {
    deps += [
      "//third_party/crashpad/crashpad/handler:crashpad_handler",
      "//third_party/crashpad/crashpad/tools:crashpad_database_util",
    ]
  }

562 563 564 565 566 567 568
  if (use_openh264) {
    deps += [
      "//third_party/openh264:common",
      "//third_party/openh264:encoder",
      "//third_party/openh264:processing",
    ]
  }
569

570
  if (!is_ios) {
571 572
    deps += [
      "//media/mojo:media_mojo_unittests",
573
      "//services:service_unittests",
574
    ]
575 576
  }

577 578 579 580
  if (!is_android && !is_ios) {
    deps += [ "//content/browser/bluetooth/tools:bluetooth_metrics_hash" ]
  }

581
  if (!is_android && !is_ios && !is_chromeos) {
582
    deps += [ "//components/proximity_auth:proximity_auth_unittests" ]
583 584
  }

ben's avatar
ben committed
585
  if (is_win || is_linux) {
sky's avatar
sky committed
586 587
    deps += [
      "//mash:all",
588
      "//media/mojo/services:media_service_unittests",
sky's avatar
sky committed
589
      "//mojo",
590
      "//services/navigation",
ben's avatar
ben committed
591
      "//services/ui/demo",
592 593
      "//services/ui/demo:mus_demo_unittests",
      "//services/ui/public/interfaces:ui_struct_traits_unittests",
ben's avatar
ben committed
594
      "//services/ui/ws:tests",
595
      "//ui/views/mus:views_mus_interactive_ui_tests",
ben's avatar
ben committed
596
      "//ui/views/mus:views_mus_unittests",
sky's avatar
sky committed
597
    ]
598

599 600 601 602 603 604
    # crbug.com/676055: media_service_unittests fails to link under Windows
    # component builds, due to duplicate symbol definitions.
    if (is_win && is_component_build) {
      deps -= [ "//media/mojo/services:media_service_unittests" ]
    }

605
    if (use_ozone && is_chromeos) {
606 607
      deps += [ "//services/ui/display:display_service_unittests" ]
    }
sky's avatar
sky committed
608 609
  }

610
  if (is_linux && !is_chromeos && !is_chromecast) {
611 612
    # TODO(GYP): Figure out if any of these should be in gn_all
    # and figure out how cross-platform they are
613
    deps += [
614 615 616
      "//chrome/installer/util:strings",
      "//chrome/tools/convert_dict",
      "//components/constrained_window:unit_tests",
617
      "//components/filesystem:filesystem_service_unittests",
618
      "//components/leveldb:leveldb_service_unittests",
619
      "//components/metrics:serialization",
620
      "//components/password_manager/content/renderer:browser_tests",
621 622 623
      "//components/rappor:unit_tests",
      "//components/sessions:unit_tests",
      "//media/blink:media_blink_unittests",
624
      "//media/cast:udp_proxy",
625 626 627 628
      "//storage/browser:dump_file_system",
      "//third_party/angle:libANGLE",
      "//third_party/angle:libEGL",
      "//third_party/angle:libGLESv2",
629
      "//third_party/leveldatabase:leveldb_test_targets",
630 631 632
      "//third_party/libjpeg_turbo:simd",
      "//third_party/opus:opus_compare",
      "//third_party/opus:opus_demo",
633
      "//third_party/opus:test_opus_api",
634 635 636 637 638 639 640 641
      "//third_party/opus:test_opus_decode",
      "//third_party/opus:test_opus_encode",
      "//third_party/opus:test_opus_padding",
      "//third_party/webrtc/system_wrappers:field_trial_default",
      "//third_party/webrtc/system_wrappers:metrics_default",
      "//ui/display/types",
      "//ui/shell_dialogs:shell_dialogs_unittests",
    ]
642

643 644 645 646
    if (enable_nacl) {
      deps += [ "//native_client/src/trusted/debug_stub:gdb_rsp_unittest" ]
    }

647
    if (target_cpu == "x86" || target_cpu == "x64") {
648 649 650
      if (!is_android) {
        deps += [ "//chrome/test:load_library_perf_tests" ]
      }
651 652
      deps += [
        "//native_client/src/trusted/platform_qualify:vcpuid",
653
        "//third_party/libjpeg_turbo:simd_asm",
654
      ]
655
    }
656
    if (is_linux && current_toolchain == host_toolchain) {
657
      deps += [ "//v8:v8_shell" ]
658 659
    }
  }
660

661 662 663 664
  if (use_ozone) {
    deps += [ "//ui/ozone/demo" ]
  }

665 666 667 668 669
  if ((is_linux && !is_chromeos && !is_chromecast) || (is_win && use_drfuzz) ||
      (use_libfuzzer && is_mac)) {
    deps += [
      "//testing/libfuzzer/fuzzers",
      "//testing/libfuzzer/tests:libfuzzer_tests",
670
      "//third_party/icu/fuzzers",
671
      "//third_party/qcms:fuzzers",
672
    ]
673 674 675 676 677 678

    # TODO(miu): Remove this dependency once the build configuration in
    # chrome/browser/BUILD.gn is migrated to chrome/browser/media/BUILD.gn.
    # This dependency here only exists to allow GN to discover the
    # fuzzer_test target there.
    deps += [ "//chrome/browser/media:cast_remoting_connector_fuzzer" ]
679 680
  }

681 682 683 684
  if (enable_nacl) {
    deps += [ "//native_client_sdk/src:nacl_core_sdk" ]
  }

685
  if (is_android) {
686 687
    deps += [
      "//build/android/gyp/test:hello_world",
688
      "//chrome/test/vr/perf:motopho_latency_test",
689
    ]
690 691
  }

692 693 694 695 696 697
  if (is_linux && use_ozone) {
    deps += [
      "//headless",
      "//headless:headless_tests",
    ]
  }
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738

  if (!is_ios) {
    deps += [ "//v8:gn_all" ]
  }
}

# TODO(GYP_GONE): This target exists for compatibility with GYP, specifically
# for the iOS bots and the official builders.
group("All") {
  testonly = true

  deps = [
    ":gn_all",
  ]
}

# TODO(GYP_GONE): This target exists for compatibility with GYP for the
# builders that specify targets in the recipes directly.
# Ideally it should not exist, and the builders should be specifying
# more specific targets (or 'All') via the source-side
# //testing/buildbot/*.json files. We should simply delete this target
# and update any recipes that are using it.
group("chromium_builder_tests") {
  testonly = true
  deps = []
}

# TODO(GYP_GONE): Figure out if we really need this target or if there's
# some better way to specify things.
if (is_win) {
  group("chrome_official_builder_no_unittests") {
    deps = [
      "//base/win:eventlog_provider",
      "//chrome/installer/gcapi",
      "//chrome/installer/mini_installer",
      "//cloud_print",
      "//cloud_print/virtual_driver/win/port_monitor:copy_gcp_portmon_binaries",
      "//components/policy:pack_policy_templates",
      "//courgette",
      "//courgette:copy_courgette_binaries",
      "//remoting/webapp",
739
      "//tools/metrics:metrics_metadata",
740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813
    ]

    if (target_cpu == "x86") {
      if (is_clang) {
        deps += [ "//courgette(//build/toolchain/win:clang_x64)" ]
      } else {
        deps += [ "//courgette(//build/toolchain/win:x64)" ]
      }
    }
    if (is_chrome_branded) {
      deps += [ "//remoting/host:remoting_host_installation" ]
    }
  }

  group("chrome_official_builder") {
    testonly = true

    deps = [
      ":chrome_official_builder_no_unittests",
      "//base:base_unittests",
      "//chrome/test:browser_tests",
      "//chrome/test:sync_integration_tests",
      "//ipc:ipc_tests",
      "//media:media_unittests",
      "//media/midi:midi_unittests",
      "//net:net_unittests",
      "//printing:printing_unittests",
      "//sql:sql_unittests",
      "//ui/base:ui_base_unittests",
      "//ui/gfx:gfx_unittests",
      "//ui/touch_selection:ui_touch_selection_unittests",
      "//ui/views:views_unittests",
      "//url:url_unittests",
    ]
  }

  group("All_syzygy") {
    if (is_syzyasan) {
      deps = [
        "//chrome/installer/mini_installer:mini_installer",
        "//chrome/installer/mini_installer:mini_installer_syzygy",
      ]
    }
  }

  if (is_syzyasan) {
    group("chrome_official_syzyasan_builder") {
      deps = [
        ":All_syzygy",
        ":chrome_official_builder_no_unittests",
      ]
    }
  }
}

if (is_chromeos) {
  group("chromiumos_preflight") {
    testonly = true
    deps = [
      "//breakpad:minidump_stackwalk($host_toolchain)",
      "//chrome",
      "//chrome/test/chromedriver",
      "//media:media_unittests",
      "//media/gpu:video_decode_accelerator_unittest",
      "//media/gpu:video_encode_accelerator_unittest",
      "//ppapi/examples/video_decode",
      "//sandbox/linux:chrome_sandbox",
      "//sandbox/linux:sandbox_linux_unittests",

      # Blocked on https://github.com/catapult-project/catapult/issues/2297
      #"//third_party/catapult/telemetry:bitmaptools",
      "//tools/perf/clear_system_cache",
    ]
  }
814 815 816
}

group("gn_visibility") {
817
  deps = [
818
    "//build/config/sanitizers:options_sources",
819 820
    # "//third_party/pdfium:pdfium_embeddertests",  # TODO(GYP): visibility?
    # "//third_party/pdfium:pdfium_unittests",  # TODO(GYP): visibility?
821
  ]
822 823 824 825

  if (!is_ios) {
    deps += [
      "//v8:postmortem-metadata",
826
      "//v8:v8_snapshot",
827 828
    ]
  }
829 830
}

831 832 833 834 835 836 837
if (!is_ios) {
  # This group includes all of the targets needed to build and test Blink,
  # including running the layout tests (see below).
  group("blink_tests") {
    testonly = true

    deps = [
838
      ":webkit_layout_tests",
839
      "//third_party/WebKit/public:all_blink",
840 841 842 843 844 845 846 847 848 849 850 851 852
    ]
  }

  # Layout tests runner
  # third_party/WebKit/Tools/Scripts/run-webkit-tests
  group("run_webkit_tests") {
    testonly = true
    deps = [
      ":webkit_layout_tests",
    ]
  }

  # https://www.chromium.org/developers/testing/webkit-layout-tests
853 854 855 856 857

  # The _exparchive at the end of the name indicates to the isolate recipe
  # that the isolate should be archived separately using the `exparchive`
  # command, rather than as part of the normal `batcharchive` command.
  group("webkit_layout_tests_exparchive") {
858
    testonly = true
859 860 861 862 863 864 865
    deps = [
      ":webkit_layout_tests",
    ]
    data_deps = [
      ":webkit_layout_tests",
    ]
  }
866

867 868 869 870 871 872
  # This target contains only a small subset of the layout tests,
  # and is useful for testing with the regular isolate mechanism.
  # To run the full layout test suite you need to use
  # :webkit_layout_tests_exparchive, above, instead.
  group("webkit_layout_tests") {
    testonly = true
873
    data_deps = [
874
      ":layout_test_data_mojo_bindings",
875
      "//content/shell:content_shell",
876
      "//mojo/public/interfaces/bindings/tests:test_associated_interfaces",
877
      "//mojo/public/interfaces/bindings/tests:test_interfaces",
878
      "//third_party/WebKit/public:blink_devtools_frontend_resources_files",
879
      "//third_party/mesa:osmesa",
880
      "//tools/imagediff",
881 882 883
    ]

    if (is_android) {
884
      data_deps += [
885
        "//breakpad:breakpad_unittests",
886 887 888 889 890
        "//breakpad:dump_syms",
        "//breakpad:microdump_stackwalk",
        "//breakpad:minidump_dump",
        "//breakpad:minidump_stackwalk",
        "//breakpad:symupload",
891
        "//tools/android/forwarder2",
892
      ]
893 894 895
    }

    if (is_win) {
896
      data_deps += [ "//content/shell:content_shell_crash_service" ]
897 898 899
    }

    if (!is_win && !is_android) {
900
      data_deps += [ "//breakpad:minidump_stackwalk($host_toolchain)" ]
901 902 903
    }

    if (is_mac) {
904
      data_deps += [ "//breakpad:dump_syms($host_toolchain)" ]
905 906 907
    }

    if (is_linux) {
908
      data_deps += [ "//breakpad:dump_syms($host_toolchain)" ]
909
    }
910 911

    data = [
912
      "$root_build_dir/resources/inspector/",
913
      "//testing/scripts/common.py",
914
      "//testing/scripts/run_isolated_script_test.py",
915
      "//testing/xvfb.py",
916
      "//third_party/WebKit/LayoutTests/",
917
      "//third_party/WebKit/PerformanceTests/",
918 919
      "//third_party/WebKit/Tools/Scripts/",
    ]
920

921 922 923 924
    if (is_win) {
      data += [ "//third_party/apache-win32/" ]
    }

925 926 927 928 929 930
    if (is_android) {
      data += [
        "//third_party/catapult/",
        "//build/android/",
      ]
    }
931
  }
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947

  copy("layout_test_data_mojo_bindings") {
    testonly = true

    sources = [
      "$root_gen_dir/mojo/public/js/mojo_bindings.js",
    ]

    outputs = [
      "$root_gen_dir/layout_test_data/mojo/public/js/mojo_bindings.js",
    ]

    deps = [
      "//mojo/public/js:new_bindings",
    ]
  }
948 949
}

950 951 952 953
# Add a dummy target for compatibility w/ GYP
group("chromium_swarm_tests") {
}

954 955 956
group("chromium_builder_perf") {
  testonly = true

957
  if (!is_ios && !is_android && !is_chromecast) {
958
    data_deps = [
959 960
      "//cc:cc_perftests",
      "//chrome/test:load_library_perf_tests",
961
      "//chrome/test:telemetry_perf_tests",
962
      "//components/tracing:tracing_perftests",
963 964
      "//gpu:gpu_perftests",
      "//media:media_perftests",
965
      "//tools/perf/chrome_telemetry_build:telemetry_chrome_test",
966 967 968
    ]

    if (!is_chromeos) {
969
      data_deps += [ "//chrome/test:performance_browser_tests" ]
970 971
    }
    if (is_linux && !is_chromeos) {
972 973 974 975
      if (is_official_build) {
        # In GN builds, this is controlled by the 'linux_dump_symbols'
        # flag, which defaults to 1 for official builds. For now,
        # we skip the separate flag and just key off of is_official_build.
976
        data_deps += [ "//chrome:linux_symbols" ]
977
      }
978

979
      data_deps += [ "//tools/perf/clear_system_cache" ]
980 981 982
    }

    if (is_win) {
983
      data_deps += [
984
        "//chrome/installer/mini_installer:mini_installer",
985
        "//chrome/test:angle_perftests",
986 987
      ]
    } else {
988
      data_deps += [ "//breakpad:minidump_stackwalk($host_toolchain)" ]
989 990 991
    }
  }
}
992

993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013
if (!is_ios && !is_android && !is_chromecast) {
  group("chromium_builder_asan") {
    testonly = true

    deps = [
      "//chrome:chrome",
      "//content/shell:content_shell",
      "//v8:d8",
    ]
    if (!is_win) {
      deps += [
        "//net:dns_fuzz_stub",
        "//skia:filter_fuzz_stub",
      ]
    }
    if (enable_ipc_fuzzer && !is_component_build) {
      deps += [ "//tools/ipc_fuzzer:ipc_fuzzer_all" ]
    }
    if (!is_chromeos) {
      deps += [
        "//third_party/pdfium/samples:pdfium_test",
1014
        "//v8:v8_shell($v8_snapshot_toolchain)",
1015 1016 1017 1018 1019
      ]
    }
    if (is_win && symbol_level == 2 && target_cpu == "x86" && is_syzyasan) {
      deps += [
        "//chrome/tools/build/win/syzygy:chrome_dll_syzygy",
1020
        "//content/shell:content_shell_syzyasan",
1021 1022 1023 1024 1025
      ]
    }
  }
}

1026 1027 1028 1029 1030 1031 1032 1033 1034
# For compatibility with GYP. The linux_chromium_chromeos_rel_ng and
# linux_chromium_chromeos_compile_rel_ng bots reference this target as
# something to build, but all targets for those bots to compile are set
# up differently.
# TODO bug 601920: Remove reference to aura_builder on bot config and delete
# this group.
group("aura_builder") {
}

1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052
if (is_android) {
  group("optimize_gn_gen") {
    deps = [
      # These run expensive scripts in non-default toolchains. Generally, host
      # toolchain targets are loaded in the later part of the run, and the
      # result is they push out the end of generation. By preloading these, the
      # scripts can be parallelized with the rest of the load.
      "//build/config/linux(//build/toolchain/linux:clang_x64)",
      "//build/config/posix(//build/toolchain/linux:clang_x64)",

      # Include x86 toolchains as well since V8 uses them for 32-bit snapshot
      # generation.
      "//build/config/linux(//build/toolchain/linux:clang_x86)",
      "//build/config/posix(//build/toolchain/linux:clang_x86)",
    ]
  }
}

1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077
# Because of the source assignment filter, many targets end up over-filtering
# their sources if the output directory contains a platform name. Assert that
# this doesn't happen. http://crbug.com/548283
template("assert_valid_out_dir") {
  # List copied from //build/config/BUILDCONFIG.gn.
  set_sources_assignment_filter([
                                  "*\bandroid/*",
                                  "*\bchromeos/*",
                                  "*\bcocoa/*",
                                  "*\bios/*",
                                  "*\blinux/*",
                                  "*\bmac/*",
                                  "*\bposix/*",
                                  "*\bwin/*",
                                ])
  assert(target_name != "")  # Mark as used.
  sources = invoker.actual_sources
  assert(
      sources == invoker.actual_sources,
      "Do not use a platform name in your output directory (found \"$root_build_dir\"). http://crbug.com/548283")
}

assert_valid_out_dir("_unused") {
  actual_sources = [ "$root_build_dir/foo" ]
}