diff options
author | brettw <brettw@chromium.org> | 2016-03-25 14:02:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-25 21:04:24 +0000 |
commit | b78fc9e5f3b3cb1fc96c50b89a3a6c7f23accee7 (patch) | |
tree | 5a9c99986042d88c330752666b4da4bf74ac8aac | |
parent | 247ad02364179cbc1b117bfcb67d086a5456235a (diff) | |
download | chromium_src-b78fc9e5f3b3cb1fc96c50b89a3a6c7f23accee7.zip chromium_src-b78fc9e5f3b3cb1fc96c50b89a3a6c7f23accee7.tar.gz chromium_src-b78fc9e5f3b3cb1fc96c50b89a3a6c7f23accee7.tar.bz2 |
Content "gn check" work.
Make content/gpu and content/plugin pass GN check. Significant work for most of content/test
Makes most of content/shell and content/test pass check. These are not all enabled yet pending a few remaining issues that are more difficult to solve.
The private content targets now allow content/test to include headers from them for non-component builds. Checking is disabled for content/test in component builds as described in the comment at the top of //content/BUILD.gn
Renames the ui/events/ipc according to GN style.
Annotates all content and gpu visibility declarations with why the're there, and fixes some incorrect ones that people added without understanding.
Reland of https://codereview.chromium.org/1828483002/ with significant changes.
TBR=jschuh (non-security-sensitive ipc build changes)
Review URL: https://codereview.chromium.org/1833193002
Cr-Commit-Position: refs/heads/master@{#383358}
33 files changed, 345 insertions, 53 deletions
@@ -36,8 +36,21 @@ check_targets = [ "//components/*", #"//content/*", # A whole lot of errors. + "//content/gpu/*", + "//content/plugin/*", "//content/public/*", "//content/renderer/*", + + #"//content/shell/*", # Needs Android fix, bug 597020. + + #"//content/test/*", # A couple of errors left. + "//content/test:content_gl_benchmark", + "//content/test:content_gl_tests", + "//content/test:content_perftests", + "//content/test:content_site_isolation_browsertests", + "//content/test:content_test_mojo_bindings", + "//content/test:content_unittests", + "//content/test:test_support", "//courgette/*", "//crypto/*", "//data/*", diff --git a/components/crash/content/app/BUILD.gn b/components/crash/content/app/BUILD.gn index 87875e5..9638bea 100644 --- a/components/crash/content/app/BUILD.gn +++ b/components/crash/content/app/BUILD.gn @@ -45,13 +45,13 @@ source_set("app") { public_deps = [ ":app_non_mac_win", + ":lib", "//third_party/kasko", ] deps = [ "//base", ] - deps += [ ":lib" ] if (is_win) { deps += [ # TODO(fdoray): Remove this once the PreRead field trial has expired. diff --git a/content/BUILD.gn b/content/BUILD.gn index 1d32ad2..1ece4f9 100644 --- a/content/BUILD.gn +++ b/content/BUILD.gn @@ -37,6 +37,23 @@ config("content_implementation") { # //content/public/browser and similar targets to avoid double-linking (these # targets make sure the dependency goes through the content shared library # when doing a component build). +# +# TESTS +# ----- +# Tests are a challenge. The content tests need to access internals of +# content/browser, for example, but the tests themselves are outside of the +# content component (which is a shared library in the component build). To +# prevent external-to-content targets from depending on private headers, +# the non-public content/browser target is not a public dep of the content +# component. But this means there is also no public path for the content +# tests and no way to restrict that just to //content/test/* if we added one. +# +# As a result, we check deps for //content/test/* only in non-component builds +# (which should verify the dependencies are correct for both component and +# non-component cases equally). There are targets like +# //content/browser:for_content_tests that allow content/test to depend on the +# //content/browser target only in non-component builds (when there are no +# linking problems) for when check is enabled. if (!is_nacl_nonsfi) { content_shared_components = [ @@ -99,6 +116,7 @@ grit("resources") { # This target exists to "hold" the content_export header so we can do proper # inclusion testing of it. source_set("export") { + # Must only be used inside of content. visibility = [ "//content/*" ] sources = [ "common/content_export.h", diff --git a/content/app/BUILD.gn b/content/app/BUILD.gn index abe8a75..1491439 100644 --- a/content/app/BUILD.gn +++ b/content/app/BUILD.gn @@ -67,13 +67,26 @@ if (!is_multi_dll_chrome) { source_set("both") { # Only the public target should depend on this. All other targets (even # internal content ones) should depend on the public one. - visibility = [ "//content/public/app:*" ] + visibility = [ + ":both_for_content_tests", # See top of //content/BUILD.gn for why. + "//content/public/app:*", + ] sources = content_app_sources configs += content_app_extra_configs deps = content_app_deps } +# See comment at the top of //content/BUILD.gn for how this works. +group("both_for_content_tests") { + visibility = [ "//content/test/*" ] + if (!is_component_build) { + public_deps = [ + ":both", + ] + } +} + if (is_multi_dll_chrome) { # It doesn't make sense to do the browser/child dll split in component mode. assert(!is_component_build) diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 9245309..fb8d3a9 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn @@ -11,7 +11,10 @@ import("//mojo/public/mojo_application_manifest.gni") source_set("browser") { # Only the public target should depend on this. All other targets (even # internal content ones) should depend on the public one. - visibility = [ "//content/public/browser:browser_sources" ] + visibility = [ + ":for_content_tests", # See top of //content/BUILD.gn for why. + "//content/public/browser:browser_sources", + ] configs += [ "//build/config:precompiled_headers", @@ -48,7 +51,7 @@ source_set("browser") { "//content/browser/notifications:notification_proto", "//content/browser/service_worker:service_worker_proto", "//content/browser/speech/proto", - "//content/common:mojo_bindings", + "//content/common", "//content/public/common:common_sources", "//content/public/common:mojo_bindings", "//crypto", @@ -526,6 +529,16 @@ source_set("browser") { } } +# See comment at the top of //content/BUILD.gn for how this works. +group("for_content_tests") { + visibility = [ "//content/test/*" ] + if (!is_component_build) { + public_deps = [ + ":browser", + ] + } +} + mojo_application_manifest("chrome_manifest") { type = "exe" application_name = "chrome" diff --git a/content/browser/tracing/BUILD.gn b/content/browser/tracing/BUILD.gn index 2122c79..b71bf1b 100644 --- a/content/browser/tracing/BUILD.gn +++ b/content/browser/tracing/BUILD.gn @@ -12,7 +12,7 @@ tracing_gen_dir = "$root_gen_dir/content/browser/tracing" tracing_grd = "$tracing_gen_dir/tracing_resources.grd" action("generate_tracing_grd") { - visibility = [ ":*" ] + visibility = [ ":*" ] # Depend on ":resources" to get this. script = "generate_trace_viewer_grd.py" input_pages = [ diff --git a/content/child/BUILD.gn b/content/child/BUILD.gn index ee79f18..910ba0e 100644 --- a/content/child/BUILD.gn +++ b/content/child/BUILD.gn @@ -7,9 +7,18 @@ import("//build/config/ui.gni") import("//content/child/child.gni") source_set("child") { - # Only the public target should depend on this. All other targets (even - # internal content ones) should depend on the public one. - visibility = [ "//content/public/child:child_sources" ] + # Targets external to content should always link to the public API. + # Internal targets can link to this but only if they're child processes + # (i.e. not content/browser or content/common) and only if they're inside the + # content component (i.e. not content/test or content/shell). + visibility = [ + "//content/gpu/*", + "//content/plugin/*", + "//content/ppapi_plugin/*", + "//content/public/child:child_sources", + "//content/renderer/*", + "//content/utility/*", + ] sources = rebase_path(content_child_gypi_values.private_child_sources, ".", @@ -33,7 +42,7 @@ source_set("child") { "//components/webcrypto", "//content/app/resources", "//content/app/strings", - "//content/common:mojo_bindings", + "//content/common", "//crypto:platform", "//mojo/common", "//mojo/message_pump", diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn index 36c5057..9a0ed5d 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn @@ -126,9 +126,11 @@ if (is_mac) { } source_set("common") { - # Only the public target should depend on this. All other targets (even - # internal content ones) should depend on the public one. - visibility = [ "//content/public/common:common_sources" ] + # Targets external to content should always link to the public API. + # In addition, targets outside of the content component (shell and tests) + # must not link to this because it will duplicate the code in the component + # build. + visibility = [ "//content/*" ] sources = rebase_path(content_common_gypi_values.private_common_sources, ".", @@ -195,7 +197,7 @@ source_set("common") { "//ui/accessibility", "//ui/base", "//ui/base/ime", - "//ui/events/ipc:events_ipc", + "//ui/events/ipc", "//ui/gfx", "//ui/gfx/geometry", "//ui/gfx/ipc", @@ -519,7 +521,23 @@ source_set("common") { } } +# See comment at the top of //content/BUILD.gn for how this works. +group("for_content_tests") { + visibility = [ "//content/test/*" ] + if (!is_component_build) { + public_deps = [ + ":common", + ] + } +} + mojom("mojo_bindings") { + # This interface is internal to content. However, this is not exported from + # the content component shared library. Code in content but outside of the + # content component (content/test or content/shell) should link to this + # directly. + visibility = [ "//content/*" ] + sources = [ "application_setup.mojom", "background_sync_service.mojom", diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn index 7736a55..a31e94f 100644 --- a/content/gpu/BUILD.gn +++ b/content/gpu/BUILD.gn @@ -8,7 +8,7 @@ import("//media/media_options.gni") # See //content/BUILD.gn for how this works. group("gpu") { - visibility = [ "//content/*" ] + visibility = [ "//content/*" ] # This is an internal content API. if (is_component_build) { public_deps = [ @@ -22,6 +22,8 @@ group("gpu") { } source_set("gpu_sources") { + # This is an internal content API. Code outside of the content "component" + # (like content/test and content/shell) should depend on ":gpu" above. visibility = [ "//content/*" ] sources = [ @@ -42,21 +44,23 @@ source_set("gpu_sources") { deps = [ "//base", + "//base/third_party/dynamic_annotations", + "//components/tracing", "//content:export", + "//content/common", "//content/public/child:child_sources", "//content/public/common:common_sources", "//gpu:gpu", "//gpu/ipc/common:command_buffer_traits", "//ipc", + "//media/mojo/services:application_factory", "//mojo/shell/public/interfaces", "//skia", + "//ui/events/ipc", + "//ui/gfx/ipc", "//ui/gl", ] - public_deps = [ - "//content/common:mojo_bindings", - ] - if (mojo_media_host == "gpu") { deps += [ "//media/mojo/services:application_factory" ] } @@ -68,6 +72,7 @@ source_set("gpu_sources") { ] libs = [ "setupapi.lib" ] deps += [ + "//sandbox", "//third_party/angle:libEGL", "//third_party/angle:libGLESv2", ] @@ -81,6 +86,10 @@ source_set("gpu_sources") { deps += [ "//ui/events/platform/x11" ] } + if (use_ozone) { + deps += [ "//ui/ozone" ] + } + if (enable_vulkan) { deps += [ "//gpu/vulkan" ] } diff --git a/content/plugin/BUILD.gn b/content/plugin/BUILD.gn index 6e87a12..94dc6d8 100644 --- a/content/plugin/BUILD.gn +++ b/content/plugin/BUILD.gn @@ -32,12 +32,19 @@ if (enable_plugins && !is_linux) { deps = [ "//content:export", + "//content/child", "//content/public/common:common_sources", "//mojo/shell/public/interfaces", "//skia", "//third_party/WebKit/public:blink", "//third_party/npapi", + "//ui/gfx", + "//ui/surface", ] + + if (is_win) { + deps += [ "//sandbox" ] + } } } else { # This way it can be unconditionally depended on. diff --git a/content/ppapi_plugin/BUILD.gn b/content/ppapi_plugin/BUILD.gn index e127a3d..eb608e7 100644 --- a/content/ppapi_plugin/BUILD.gn +++ b/content/ppapi_plugin/BUILD.gn @@ -3,7 +3,7 @@ # found in the LICENSE file. group("ppapi_plugin") { - visibility = [ "//content/*" ] + visibility = [ "//content/*" ] # This is an internal content API. if (is_component_build) { public_deps = [ @@ -17,7 +17,11 @@ group("ppapi_plugin") { } source_set("ppapi_plugin_sources") { - visibility = [ "//content/*" ] + # Depend on via ":ppapi_plugin above. + visibility = [ + ":ppapi_plugin", + "//content", # For the component build. + ] sources = [ "broker_process_dispatcher.cc", diff --git a/content/public/browser/BUILD.gn b/content/public/browser/BUILD.gn index 643cb8f..5b04b1e 100644 --- a/content/public/browser/BUILD.gn +++ b/content/public/browser/BUILD.gn @@ -19,6 +19,7 @@ group("browser") { } source_set("browser_sources") { + # External code should depend on via ":browser" above. visibility = [ "//content/*" ] sources = rebase_path(content_browser_gypi_values.public_browser_sources, @@ -40,7 +41,7 @@ source_set("browser_sources") { ] deps = [ "//cc", - "//content/browser", + "//content/browser", # Must not be public_deps! "//content/public/common:common_sources", "//gpu", "//media", diff --git a/content/public/child/BUILD.gn b/content/public/child/BUILD.gn index 6573af8..68c9986 100644 --- a/content/public/child/BUILD.gn +++ b/content/public/child/BUILD.gn @@ -24,6 +24,7 @@ group("child") { } source_set("child_sources") { + # External code should depend in via ":child" above. visibility = [ "//content/*" ] sources = rebase_path(content_child_gypi_values.public_child_sources, diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn index 39a95fd..02712fe 100644 --- a/content/public/common/BUILD.gn +++ b/content/public/common/BUILD.gn @@ -78,6 +78,7 @@ source_set("static_switches") { } source_set("common_sources") { + # External code should depend on via ":common" above. visibility = [ "//content/*" ] sources = rebase_path(content_common_gypi_values.public_common_sources, diff --git a/content/public/gpu/BUILD.gn b/content/public/gpu/BUILD.gn index 63550aa..fa0be53 100644 --- a/content/public/gpu/BUILD.gn +++ b/content/public/gpu/BUILD.gn @@ -16,6 +16,8 @@ group("gpu") { } source_set("gpu_sources") { + # You must depend on this via //content/public/gpu above for the component + # build to work properly. visibility = [ "//content/*" ] configs += [ "//content:content_implementation" ] @@ -30,4 +32,6 @@ source_set("gpu_sources") { "//content/gpu:gpu_sources", "//content/public/common:common_sources", ] + + allow_circular_includes_from = [ "//content/gpu:gpu_sources" ] } diff --git a/content/public/plugin/BUILD.gn b/content/public/plugin/BUILD.gn index e4c4d36..1693b4e 100644 --- a/content/public/plugin/BUILD.gn +++ b/content/public/plugin/BUILD.gn @@ -16,6 +16,7 @@ group("plugin") { } source_set("plugin_sources") { + # External code should depend on via ":plugin" above. visibility = [ "//content/*" ] sources = [ @@ -24,7 +25,13 @@ source_set("plugin_sources") { deps = [ "//base", - "//content/plugin", + "//content/plugin", # Must not be a public dep. "//content/public/common:common_sources", ] + + allow_circular_includes_from = [ + # This target is a pair with content/plugin. They always go together and + # include headers from each other. + "//content/plugin", + ] } diff --git a/content/public/renderer/BUILD.gn b/content/public/renderer/BUILD.gn index c31a7bb..c0eaab1 100644 --- a/content/public/renderer/BUILD.gn +++ b/content/public/renderer/BUILD.gn @@ -19,6 +19,7 @@ group("renderer") { } source_set("renderer_sources") { + # External code should depend on via ":renderer" above. visibility = [ "//content/*" ] sources = rebase_path(content_renderer_gypi_values.public_renderer_sources, diff --git a/content/public/utility/BUILD.gn b/content/public/utility/BUILD.gn index c9fce03..c0e514c 100644 --- a/content/public/utility/BUILD.gn +++ b/content/public/utility/BUILD.gn @@ -18,6 +18,7 @@ group("utility") { } source_set("utility_sources") { + # External code should depend on via ":utility" above. visibility = [ "//content/*" ] sources = rebase_path(content_utility_gypi_values.public_utility_sources, diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn index bf45546..f9a554d0 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn @@ -10,7 +10,10 @@ import("//media/media_options.gni") source_set("renderer") { # Only the public target should depend on this. All other targets (even # internal content ones) should depend on the public one. - visibility = [ "//content/public/renderer:renderer_sources" ] + visibility = [ + ":for_content_tests", + "//content/public/renderer:renderer_sources", + ] sources = rebase_path(content_renderer_gypi_values.private_renderer_sources, ".", @@ -23,6 +26,7 @@ source_set("renderer") { ] defines = [] + public_deps = [] deps = [ "//base:i18n", "//cc", @@ -33,7 +37,7 @@ source_set("renderer") { "//components/scheduler:scheduler", "//components/url_formatter", "//content:resources", - "//content/common:mojo_bindings", + "//content/common", "//content/gpu:gpu_sources", "//content/public/child:child_sources", "//content/public/common:common_sources", @@ -87,7 +91,7 @@ source_set("renderer") { allow_circular_includes_from = [] if (use_aura) { - deps += [ "//content/renderer/mus" ] + public_deps += [ "//content/renderer/mus" ] allow_circular_includes_from += [ "//content/renderer/mus" ] } @@ -247,3 +251,13 @@ source_set("renderer") { deps += [ "//ui/ozone" ] } } + +# See comment at the top of //content/BUILD.gn for how this works. +group("for_content_tests") { + visibility = [ "//content/test/*" ] + if (!is_component_build) { + public_deps = [ + ":renderer", + ] + } +} diff --git a/content/renderer/mus/BUILD.gn b/content/renderer/mus/BUILD.gn index dc471fc..6155680 100644 --- a/content/renderer/mus/BUILD.gn +++ b/content/renderer/mus/BUILD.gn @@ -3,6 +3,9 @@ # found in the LICENSE file. source_set("mus") { + # Depend on this only via //content/renderer. + visibility = [ "//content/renderer/*" ] + sources = [ "compositor_mus_connection.cc", "compositor_mus_connection.h", @@ -19,7 +22,7 @@ source_set("mus") { "//cc", "//components/mus/public/cpp", "//components/mus/public/interfaces", - "//content/common:mojo_bindings", + "//content/common", "//content/public/common:common_sources", "//mojo/common", "//mojo/converters/blink", diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn index 6ce50f8..4fd4c91 100644 --- a/content/shell/BUILD.gn +++ b/content/shell/BUILD.gn @@ -221,12 +221,14 @@ static_library("content_shell_lib") { "//content/app/strings", "//content/gpu", "//content/test:layouttest_support", + "//content/test:test_support", "//device/bluetooth", "//device/bluetooth:mocks", "//gin", "//gpu", "//ipc", "//media", + "//media/mojo/services:application_factory", "//net", "//net:net_resources", "//skia", @@ -255,6 +257,7 @@ static_library("content_shell_lib") { "//content/ppapi_plugin", "//ppapi:blink_deprecated_test_plugin", "//ppapi:blink_test_plugin", + "//ppapi/shared_impl", ] } if (mojo_media_host == "browser") { @@ -270,7 +273,10 @@ static_library("content_shell_lib") { } if (is_linux) { - deps += [ "//build/linux:fontconfig" ] + deps += [ + "//build/linux:fontconfig", + "//ui/gfx:test_support", + ] } if (use_x11) { @@ -289,7 +295,10 @@ static_library("content_shell_lib") { } if (is_posix && !is_mac) { - deps += [ "//components/crash/content/browser" ] + deps += [ + "//components/crash/content/app", + "//components/crash/content/browser", + ] } if (use_aura) { @@ -308,6 +317,7 @@ static_library("content_shell_lib") { "//ui/views", "//ui/views:test_support", "//ui/views/controls/webview", + "//ui/wm:test_support", ] } else { sources += [ "browser/shell_aura.cc" ] @@ -344,6 +354,7 @@ static_library("content_shell_lib") { } grit("content_shell_resources_grit") { + # External code should depend on ":resources" instead. visibility = [ ":*" ] source = "shell_resources.grd" outputs = [ diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index acb1539..8c5b725 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -24,6 +24,12 @@ content_tests_gypi_values = source_set("test_support") { testonly = true + # See comment at the top of //content/BUILD.gn for why this is disabled in + # component builds. + if (is_component_build) { + check_includes = false + } + configs += [ "//build/config:precompiled_headers", "//v8:external_startup_data", @@ -36,19 +42,26 @@ source_set("test_support") { "//third_party/WebKit/public:blink", ] deps = [ + ":browsertest_base", ":content_test_mojo_bindings", + "//base/third_party/dynamic_annotations", "//cc", "//cc:test_support", "//cc/blink", + "//cc/surfaces", "//components/scheduler:scheduler", "//components/scheduler:test_support", + "//content/app:both_for_content_tests", "//content/browser/speech/proto", "//content/gpu", + "//content/public/browser", "//content/public/child", "//content/public/plugin", "//content/public/renderer", "//content/public/utility", + "//content/renderer:for_content_tests", "//content/shell:pak", + "//content/utility:for_content_tests", "//ipc:test_support", "//ipc/mojo", "//media", @@ -120,6 +133,7 @@ source_set("test_support") { deps += [ "//third_party/libjingle:libjingle_webrtc", "//third_party/libjingle:libpeerconnection", + "//third_party/webrtc/base:rtc_base", "//third_party/webrtc/modules/video_capture", ] } @@ -180,6 +194,12 @@ source_set("test_support") { source_set("browsertest_support") { testonly = true + # See comment at the top of //content/BUILD.gn for why this is disabled in + # component builds. + if (is_component_build) { + check_includes = false + } + sources = [ "../public/test/content_browser_test.cc", "../public/test/content_browser_test.h", @@ -192,10 +212,24 @@ source_set("browsertest_support") { ] deps = [ + ":browsertest_base", + ":test_support", + "//base", + "//base:i18n", + "//base/test:test_config", + "//base/test:test_support", + "//cc/surfaces", + "//content/app:both_for_content_tests", + "//content/browser:for_content_tests", "//content/shell:content_shell_lib", + "//gin", + "//media", + "//net", "//skia", "//testing/gtest", "//ui/accessibility:ax_gen", + "//ui/base", + "//ui/base/ime", ] if (is_android) { @@ -220,12 +254,14 @@ source_set("browsertest_base") { ] public_deps = [ + "//content/browser:for_content_tests", "//content/public/browser", "//content/public/common", "//third_party/WebKit/public:blink", ] deps = [ "//base:base", + "//content/public/app:both", "//net:test_support", "//testing/gtest", "//ui/base", @@ -253,6 +289,13 @@ mojom("web_ui_test_mojo_bindings") { # GYP version //content/content_tests.gypi:layouttest_support_content static_library("layouttest_support") { testonly = true + + # See comment at the top of //content/BUILD.gn for why this is disabled in + # component builds. + if (is_component_build) { + check_includes = false + } + sources = rebase_path(content_tests_gypi_values.layouttest_support_content_sources, ".", @@ -263,7 +306,11 @@ static_library("layouttest_support") { "//cc", "//cc/blink", "//components/test_runner:test_runner", + "//content/browser:for_content_tests", "//content/public/common", + + #"//content/shell:content_shell_lib", + "//content/renderer:for_content_tests", "//mojo/edk/test:test_support", "//skia", "//ui/accessibility:ax_gen", @@ -339,6 +386,12 @@ group("content_site_isolation_browsertests") { } test("content_browsertests") { + # See comment at the top of //content/BUILD.gn for why this is disabled in + # component builds. + if (is_component_build) { + check_includes = false + } + sources = rebase_path(content_tests_gypi_values.content_browsertests_sources, ".", "//content") @@ -389,15 +442,22 @@ test("content_browsertests") { deps = [ ":browsertest_base", ":browsertest_support", + ":content_test_mojo_bindings", ":web_ui_test_mojo_bindings", "//base/test:test_support", + "//components/scheduler", "//content:resources", + "//content/app:both_for_content_tests", + "//content/browser:for_content_tests", "//content/browser/background_sync:background_sync_proto", "//content/common:mojo_bindings", "//content/gpu", + "//content/public/browser", + "//content/public/child", "//content/public/common", "//content/public/plugin", "//content/public/renderer", + "//content/renderer:for_content_tests", "//content/shell:content_shell_lib", "//content/shell:pak", "//content/test:test_support", @@ -406,9 +466,9 @@ test("content_browsertests") { "//device/vibration:mojo_bindings", "//gin", "//gpu", + "//gpu/blink", "//ipc:test_support", - "//media:media_features", - "//media:shared_memory_support", + "//media", "//media:test_support", "//media/audio:test_support", "//media/base:test_support", @@ -419,6 +479,7 @@ test("content_browsertests") { "//mojo/shell/public/cpp:cpp_for_chromium", "//mojo/test:test_support", "//net:test_support", + "//storage/browser", "//testing/gmock", "//testing/gtest", "//third_party/WebKit/public:blink", @@ -427,8 +488,9 @@ test("content_browsertests") { "//third_party/zlib", "//ui/accessibility", "//ui/accessibility:ax_gen", - "//ui/base", + "//ui/base:test_support", "//ui/base/ime", + "//ui/compositor", "//ui/gfx", "//ui/gfx/geometry", "//ui/gl", @@ -447,7 +509,7 @@ test("content_browsertests") { "//ppapi/host", "//ppapi/proxy", "//ppapi/proxy:ipc", - "//ppapi/shared_impl", + "//ppapi/shared_impl:test_support", ] data_deps += [ "//ppapi:ppapi_tests" ] } @@ -524,6 +586,7 @@ test("content_browsertests") { content_tests_gypi_values.content_browsertests_plugins_sources, ".", "//content") + deps += [ "//ppapi/proxy:test_support" ] data_deps += [ "//ppapi:ppapi_tests" ] } @@ -543,6 +606,7 @@ test("content_browsertests") { if (use_aura) { deps += [ + "//ui/aura", "//ui/touch_selection:test_support", "//ui/touch_selection:touch_selection", ] @@ -556,6 +620,12 @@ test("content_browsertests") { } test("content_unittests") { + # See comment at the top of //content/BUILD.gn for why this is disabled in + # component builds. + if (is_component_build) { + check_includes = false + } + defines = [] sources = rebase_path(content_tests_gypi_values.content_unittests_sources, ".", @@ -573,14 +643,17 @@ test("content_unittests") { configs += [ "//build/config:precompiled_headers" ] deps = [ + ":content_test_mojo_bindings", ":test_support", "//base/test:test_support", "//base/third_party/dynamic_annotations", "//cc", "//cc:test_support", "//cc/surfaces", + "//components/scheduler", "//content:resources", - "//content/browser/background_sync:background_sync_proto", + "//content/app:both_for_content_tests", + "//content/browser:for_content_tests", "//content/browser/cache_storage:cache_storage_proto", "//content/browser/notifications:notification_proto", "//content/browser/service_worker:service_worker_proto", @@ -593,6 +666,7 @@ test("content_unittests") { "//content/public/common:mojo_bindings", "//content/public/plugin", "//content/public/renderer", + "//content/renderer:for_content_tests", "//crypto", "//device/battery", "//device/battery:mojo_bindings", @@ -610,6 +684,8 @@ test("content_unittests") { "//mojo/public/cpp/bindings", "//net:extras", "//net:test_support", + "//ppapi/c", + "//printing", "//skia", "//sql", "//sql:test_support", @@ -622,11 +698,12 @@ test("content_unittests") { "//third_party/leveldatabase", "//third_party/libjingle", "//third_party/re2", + "//third_party/widevine/cdm:version_h", "//ui/accessibility", - "//ui/base", + "//ui/base:test_support", "//ui/compositor:test_support", "//ui/events/blink", - "//ui/gfx", + "//ui/gfx:test_support", "//ui/gfx/geometry", "//ui/gfx/ipc", "//ui/gl", @@ -646,6 +723,11 @@ test("content_unittests") { rebase_path(content_tests_gypi_values.content_unittests_plugins_sources, ".", "//content") + deps += [ + "//ppapi/host", + "//ppapi/proxy:test_support", + "//ppapi/shared_impl:test_support", + ] } if (enable_webrtc) { @@ -656,6 +738,8 @@ test("content_unittests") { deps += [ "//third_party/libjingle:libjingle_webrtc", "//third_party/libjingle:libpeerconnection", + "//third_party/webrtc/base:rtc_base", + "//third_party/webrtc/modules/desktop_capture:primitives", "//third_party/webrtc/modules/video_capture", "//ui/shell_dialogs:shell_dialogs", ] @@ -703,7 +787,10 @@ test("content_unittests") { # Search for comments about "xcode_settings" in chrome_tests.gypi. ldflags = [ "-Wl,-ObjC" ] - deps += [ "//third_party/ocmock" ] + deps += [ + "//third_party/mozilla", + "//third_party/ocmock", + ] } if (is_chromeos) { sources -= [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ] @@ -738,7 +825,7 @@ test("content_unittests") { if (use_aura) { deps += [ "//components/mus/public/cpp/tests:unittest_support", - "//ui/aura", + "//ui/aura:test_support", "//ui/aura_extra", "//ui/wm", ] @@ -783,9 +870,19 @@ test("content_unittests") { if (is_mac && use_openssl) { deps += [ "//third_party/boringssl" ] } + + if (use_x11) { + deps += [ "//ui/gfx/x" ] + } } test("content_perftests") { + # See comment at the top of //content/BUILD.gn for why this is disabled in + # component builds. + if (is_component_build) { + check_includes = false + } + sources = [ "../browser/renderer_host/input/input_router_impl_perftest.cc", "../common/cc_messages_perftest.cc", @@ -794,6 +891,7 @@ test("content_perftests") { deps = [ "//base/test:test_support", "//cc", + "//content/browser:for_content_tests", "//content/public/browser", "//content/public/common", "//content/test:test_support", @@ -810,6 +908,12 @@ test("content_perftests") { } test("content_gl_tests") { + # See comment at the top of //content/BUILD.gn for why this is disabled in + # component builds. + if (is_component_build) { + check_includes = false + } + sources = [ "../browser/compositor/gl_helper_unittest.cc", "../common/gpu/client/gpu_in_process_context_tests.cc", @@ -819,9 +923,13 @@ test("content_gl_tests") { deps = [ ":test_support", "//base/test:test_support", + "//content/browser:for_content_tests", "//content/public/common", "//gpu/blink", + "//gpu/command_buffer/client:gl_in_process_context", + "//gpu/command_buffer/client:gles2_implementation", "//gpu/command_buffer/common", + "//media", "//testing/gtest", "//third_party/WebKit/public:blink", "//ui/base", @@ -847,6 +955,12 @@ test("content_gl_tests") { } test("content_gl_benchmark") { + # See comment at the top of //content/BUILD.gn for why this is disabled in + # component builds. + if (is_component_build) { + check_includes = false + } + sources = [ "../browser/compositor/gl_helper_benchmark.cc", "run_gl_benchmark.cc", @@ -855,8 +969,11 @@ test("content_gl_benchmark") { deps = [ ":test_support", "//base/test:test_support", + "//content/browser:for_content_tests", "//content/public/common", "//gpu/blink", + "//gpu/command_buffer/client:gl_in_process_context", + "//gpu/command_buffer/client:gles2_implementation", "//testing/gtest", "//third_party/WebKit/public:blink", "//ui/base", diff --git a/content/utility/BUILD.gn b/content/utility/BUILD.gn index 9aea9db..0ef4261 100644 --- a/content/utility/BUILD.gn +++ b/content/utility/BUILD.gn @@ -7,8 +7,11 @@ import("//media/media_options.gni") source_set("utility") { # Only the public target should depend on this. All other targets (even - # internal content ones) should depend on the public one. - visibility = [ "//content/public/utility:utility_sources" ] + # internal content ones other than test) should depend on the public one. + visibility = [ + ":for_content_tests", + "//content/public/utility:utility_sources", + ] sources = rebase_path(content_utility_gypi_values.utility_sources, ".", "//content") @@ -17,11 +20,13 @@ source_set("utility") { deps = [ "//base", + "//components/scheduler", "//content:export", "//content/public/child:child_sources", "//content/public/common:common_sources", "//content/public/common:mojo_bindings", "//courgette:courgette_lib", + "//media/mojo/services:application_factory", "//mojo/common", "//mojo/public/cpp/bindings", "//mojo/shell", @@ -35,3 +40,13 @@ source_set("utility") { deps += [ "//media/mojo/services:application_factory" ] } } + +# See comment at the top of //content/BUILD.gn for how this works. +group("for_content_tests") { + visibility = [ "//content/test/*" ] + if (!is_component_build) { + public_deps = [ + ":utility", + ] + } +} diff --git a/gpu/command_buffer/client/BUILD.gn b/gpu/command_buffer/client/BUILD.gn index fb623e3..e2c1107 100644 --- a/gpu/command_buffer/client/BUILD.gn +++ b/gpu/command_buffer/client/BUILD.gn @@ -40,6 +40,8 @@ component("client_sources_for_ppapi") { } source_set("client_sources") { + # External code should depend on this via //gpu/client above rather than + # depending on this directly or the component build will break. visibility = [ "//gpu/*" ] sources = [ diff --git a/gpu/command_buffer/service/BUILD.gn b/gpu/command_buffer/service/BUILD.gn index 7ad6816..3b83386 100644 --- a/gpu/command_buffer/service/BUILD.gn +++ b/gpu/command_buffer/service/BUILD.gn @@ -18,10 +18,9 @@ group("service") { } source_set("service_sources") { - visibility = [ - "//gpu/*", - "//mojo/gles2:gles2", - ] + # External code should depend on this via //gpu/command_buffer/service above + # rather than depending on this directly or the component build will break. + visibility = [ "//gpu/*" ] sources = [ "buffer_manager.cc", diff --git a/gpu/config/BUILD.gn b/gpu/config/BUILD.gn index 3ca9edf..d0434ea 100644 --- a/gpu/config/BUILD.gn +++ b/gpu/config/BUILD.gn @@ -23,10 +23,9 @@ group("config") { } source_set("config_sources") { - visibility = [ - "//components/mus/gles2:*", - "//gpu/*", - ] + # External code should depend on this via //gpu/config above rather than + # depending on this directly or the component build will break. + visibility = [ "//gpu/*" ] sources = [ "dx_diag_node.cc", diff --git a/gpu/ipc/common/BUILD.gn b/gpu/ipc/common/BUILD.gn index 074f7d9..c596e26 100644 --- a/gpu/ipc/common/BUILD.gn +++ b/gpu/ipc/common/BUILD.gn @@ -29,6 +29,9 @@ group("command_buffer_traits") { } source_set("command_buffer_traits_sources") { + # External code should depend on this via + # //gpu/ipc/common:command_buffer_traits above rather than depending on this + # directly or the component build will break. visibility = [ "//gpu/*" ] sources = [ @@ -51,6 +54,8 @@ source_set("command_buffer_traits_sources") { } source_set("ipc_common_sources") { + # External code should depend on this via //gpu/ipc/common above rather than + # depending on this directly or the component build will break. visibility = [ "//gpu/*" ] sources = [ @@ -81,7 +86,7 @@ source_set("ipc_common_sources") { "//gpu/command_buffer/common:common_sources", "//gpu/config:config_sources", "//ipc", - "//ui/events/ipc:events_ipc", + "//ui/events/ipc", "//ui/gfx/ipc", "//ui/gl", "//url/ipc:url_ipc", diff --git a/media/BUILD.gn b/media/BUILD.gn index 84e0b03..efe4d1a 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -722,9 +722,11 @@ source_set("test_support") { "video/mock_video_decode_accelerator.cc", "video/mock_video_decode_accelerator.h", ] - deps = [ + public_deps = [ ":media", ":shared_memory_support", + ] + deps = [ "//base", "//skia", "//testing/gmock", diff --git a/mojo/gles2/BUILD.gn b/mojo/gles2/BUILD.gn index 0fb54c1..705a8eb 100644 --- a/mojo/gles2/BUILD.gn +++ b/mojo/gles2/BUILD.gn @@ -56,7 +56,7 @@ component("gles2") { ] if (!is_component_build) { - deps += [ "//gpu/command_buffer/service:service_sources" ] + deps += [ "//gpu/command_buffer/service" ] } include_dirs = [ ".." ] diff --git a/ppapi/proxy/BUILD.gn b/ppapi/proxy/BUILD.gn index 66cb384..1e41208 100644 --- a/ppapi/proxy/BUILD.gn +++ b/ppapi/proxy/BUILD.gn @@ -362,6 +362,9 @@ source_set("test_support") { "resource_message_test_sink.h", ] + public_deps = [ + ":proxy", + ] deps = [ "//base/test:test_support", "//ipc", diff --git a/ppapi/shared_impl/BUILD.gn b/ppapi/shared_impl/BUILD.gn index 6fbb136..67bd069 100644 --- a/ppapi/shared_impl/BUILD.gn +++ b/ppapi/shared_impl/BUILD.gn @@ -207,12 +207,14 @@ source_set("test_support") { "test_utils.h", ] + public_deps = [ + "//ppapi/shared_impl", + ] deps = [ "//base/test:test_support", "//ipc", "//ipc:test_support", "//ppapi/proxy", - "//ppapi/shared_impl", "//testing/gmock", "//testing/gtest", ] diff --git a/ui/events/BUILD.gn b/ui/events/BUILD.gn index 44087eb..20b75f2 100644 --- a/ui/events/BUILD.gn +++ b/ui/events/BUILD.gn @@ -404,7 +404,7 @@ test("events_unittests") { "//third_party/WebKit/public:blink_headers", "//ui/events/blink", "//ui/events/gestures/blink", - "//ui/events/ipc:events_ipc", + "//ui/events/ipc", ] } diff --git a/ui/events/ipc/BUILD.gn b/ui/events/ipc/BUILD.gn index 975b875..b6ccbf5 100644 --- a/ui/events/ipc/BUILD.gn +++ b/ui/events/ipc/BUILD.gn @@ -4,7 +4,7 @@ import("//build/config/ui.gni") -component("events_ipc") { +component("ipc") { output_name = "events_ipc" sources = [ "latency_info_param_traits.cc", |