diff --git a/api/task_queue/BUILD.gn b/api/task_queue/BUILD.gn index 7d449778bb..00be7842df 100644 --- a/api/task_queue/BUILD.gn +++ b/api/task_queue/BUILD.gn @@ -39,6 +39,15 @@ rtc_library("task_queue_test") { check_includes = false # no-presubmit-check TODO(bugs.webrtc.org/9419) if (build_with_chromium) { + visibility = [] + visibility = webrtc_default_visibility + visibility += [ + # This is the only Chromium target that can depend on this. The reason + # behind this is the fact that this is a 'testonly' target and as such + # it cannot be part of the WebRTC component. + "//third_party/blink/renderer/platform:blink_platform_unittests_sources", + ] + # Don't depend on WebRTC code outside of webrtc_overrides:webrtc_component # because this will break the WebRTC component build in Chromium. deps = [ diff --git a/webrtc.gni b/webrtc.gni index 4e0f3641f2..ec0ca54940 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -471,6 +471,21 @@ template("rtc_source_set") { } } + # Chromium should only depend on the WebRTC component in order to + # avoid to statically link WebRTC in a component build. + if (build_with_chromium) { + publicly_visible = false + foreach(v, visibility) { + if (v == "*") { + publicly_visible = true + } + } + if (publicly_visible) { + visibility = [] + visibility = webrtc_default_visibility + } + } + if (!defined(testonly) || !testonly) { configs += rtc_prod_configs } @@ -643,6 +658,21 @@ template("rtc_library") { } } + # Chromium should only depend on the WebRTC component in order to + # avoid to statically link WebRTC in a component build. + if (build_with_chromium) { + publicly_visible = false + foreach(v, visibility) { + if (v == "*") { + publicly_visible = true + } + } + if (publicly_visible) { + visibility = [] + visibility = webrtc_default_visibility + } + } + if (!defined(testonly) || !testonly) { configs += rtc_prod_configs }