Add rtc_common_public_deps

When built for chromium, some webrtc implementations are overridden and
are implemented by chrome's "//base". For instance webrtc::Location is
implemented by base::Location. So far so good, the affected targets are
correctly defined in GN to depend on base.

The problem: Most targets in webrtc do not declare correctly their
public_deps. When a public header of a target includes one from its
dependency, the dependency must be a public_deps. The public_deps
instruct GN to forward the capability to use code from the dependency
toward the dependent.

Unfortunately, it is not possible to fix the `public_deps` in webrtc,
because its is disallowed via a presubmit. See:
https://webrtc-review.googlesource.com/c/src/+/30262

WebRTC developers decided not to use `public_deps`, because GN config
are "translated" toward different kind of downstream build system who do
not really support the `public` dependencies concept. Instead WebRTC is
using some "common" configuration applied to all of its targets.

This patch add `rtc_common_public_deps` argument, to let embedders
add the dependencies WebRTC depends on.

Bug: chromium:1467773
Change-Id: I7de43372414a09886fcb07905451e6339c8ecc64
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/316660
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40595}
This commit is contained in:
Arthur Sonzogni 2023-08-22 09:55:36 +00:00 committed by WebRTC LUCI CQ
parent 5f3b3db105
commit 47faf32287
5 changed files with 29 additions and 15 deletions

View File

@ -268,7 +268,7 @@ rtc_library("libjingle_peerconnection_api") {
"dtmf_sender_interface.h",
"rtp_sender_interface.h",
]
public_deps = [ # no-presubmit-check TODO(webrtc:8603)
public_deps += [ # no-presubmit-check TODO(webrtc:8603)
# Remove when downstream has been updated
":dtmf_sender_interface",
":rtp_sender_interface",

View File

@ -155,7 +155,7 @@ rtc_library("g711") {
"../../rtc_base:checks",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
public_deps = [ ":g711_c" ] # no-presubmit-check TODO(webrtc:8603)
public_deps += [ ":g711_c" ] # no-presubmit-check TODO(webrtc:8603)
}
rtc_library("g711_c") {
@ -188,7 +188,7 @@ rtc_library("g722") {
"../../rtc_base:safe_conversions",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
public_deps = [ ":g722_c" ] # no-presubmit-check TODO(webrtc:8603)
public_deps += [ ":g722_c" ] # no-presubmit-check TODO(webrtc:8603)
}
rtc_library("g722_c") {
@ -223,7 +223,7 @@ rtc_library("ilbc") {
"../../rtc_base:safe_conversions",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
public_deps = [ ":ilbc_c" ] # no-presubmit-check TODO(webrtc:8603)
public_deps += [ ":ilbc_c" ] # no-presubmit-check TODO(webrtc:8603)
}
rtc_library("ilbc_c") {
@ -430,7 +430,7 @@ rtc_library("pcm16b") {
"../../rtc_base:buffer",
"../../rtc_base:checks",
]
public_deps = [ ":pcm16b_c" ] # no-presubmit-check TODO(webrtc:8603)
public_deps += [ ":pcm16b_c" ] # no-presubmit-check TODO(webrtc:8603)
}
rtc_library("pcm16b_c") {
@ -492,7 +492,7 @@ rtc_library("webrtc_opus") {
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
public_deps = # no-presubmit-check TODO(webrtc:8603)
public_deps += # no-presubmit-check TODO(webrtc:8603)
[ ":webrtc_opus_wrapper" ]
defines = audio_codec_defines
@ -526,7 +526,7 @@ rtc_library("webrtc_multiopus") {
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
public_deps = # no-presubmit-check TODO(webrtc:8603)
public_deps += # no-presubmit-check TODO(webrtc:8603)
[ ":webrtc_opus_wrapper" ]
defines = audio_codec_defines
@ -609,7 +609,7 @@ rtc_library("audio_network_adaptor") {
"audio_network_adaptor/util/threshold_curve.h",
]
public_deps = # no-presubmit-check TODO(webrtc:8603)
public_deps += # no-presubmit-check TODO(webrtc:8603)
[ ":audio_network_adaptor_config" ]
deps = [
@ -892,7 +892,7 @@ rtc_library("neteq_tools") {
"neteq/tools/neteq_event_log_input.h",
]
deps += [ "../../logging:rtc_event_log_parser" ]
public_deps = # no-presubmit-check TODO(webrtc:8603)
public_deps += # no-presubmit-check TODO(webrtc:8603)
[ "../../logging:rtc_event_log_proto" ]
}
}

View File

@ -31,7 +31,7 @@ rtc_source_set("audio_device_default") {
rtc_source_set("audio_device") {
visibility = [ "*" ]
public_deps = [
public_deps += [ # no-presubmit-check TODO(webrtc:8603)
":audio_device_api",
# Deprecated.

View File

@ -484,7 +484,6 @@ rtc_source_set("test_support") {
"gtest.h",
]
public_deps = [] # no-presubmit-check TODO(webrtc:8603)
if (is_ios) {
public_deps += # no-presubmit-check TODO(webrtc:8603)
[ ":test_support_objc" ]
@ -915,9 +914,9 @@ rtc_library("fileutils_override_impl") {
rtc_source_set("run_test") {
testonly = true
if (is_mac) {
public_deps = [ ":run_test_objc" ] # no-presubmit-check TODO(webrtc:8603)
public_deps += [ ":run_test_objc" ] # no-presubmit-check TODO(webrtc:8603)
} else {
public_deps = # no-presubmit-check TODO(webrtc:8603)
public_deps += # no-presubmit-check TODO(webrtc:8603)
[ ":run_test_generic" ]
}
}
@ -981,7 +980,7 @@ rtc_library("direct_transport") {
"../rtc_base/task_utils:repeating_task",
]
absl_deps = [ "//third_party/abseil-cpp/absl/memory" ]
public_deps = # no-presubmit-check TODO(webrtc:8603)
public_deps += # no-presubmit-check TODO(webrtc:8603)
[ "../call:fake_network" ]
}
@ -1093,7 +1092,7 @@ rtc_library("mock_transport") {
}
rtc_source_set("test_renderer") {
public_deps = # no-presubmit-check TODO(webrtc:8603)
public_deps += # no-presubmit-check TODO(webrtc:8603)
[ ":test_renderer_generic" ]
testonly = true
if (is_mac) {

View File

@ -251,6 +251,15 @@ declare_args() {
# with this string.
# See the definition of RTC_OBJC_TYPE_PREFIX in the code.
rtc_objc_prefix = ""
# Embedders can define dependencies needed by WebRTC. Dependencies can be
# configs or targets. This can be defined in their `.gn` file.
#
# In practise, this is use by Chromium: Targets from
# `//third_party/webrtc_overrides` are depending on Chrome's `//base`, but
# WebRTC does not declare its public dependencies. See webrtc:8603. Instead
# WebRTC is using a global common dependencies.
rtc_common_public_deps = [] # no-presubmit-check TODO(webrtc:8603)
}
if (!build_with_mozilla) {
@ -387,34 +396,40 @@ rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ]
set_defaults("rtc_test") {
configs = rtc_add_configs
public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603)
suppressed_configs = []
}
set_defaults("rtc_library") {
configs = rtc_add_configs
public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603)
suppressed_configs = []
absl_deps = []
}
set_defaults("rtc_source_set") {
configs = rtc_add_configs
public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603)
suppressed_configs = []
absl_deps = []
}
set_defaults("rtc_static_library") {
configs = rtc_add_configs
public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603)
suppressed_configs = []
absl_deps = []
}
set_defaults("rtc_executable") {
configs = rtc_add_configs
public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603)
suppressed_configs = []
}
set_defaults("rtc_shared_library") {
configs = rtc_add_configs
public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603)
suppressed_configs = []
}