Add absl_deps field for rtc_test and rtc_executable
To be able to build these targets in chromium we need to replace all abseil dependencies with "//third_party/abseil-cpp:absl".
Bug: webrtc:12404
Change-Id: Ie0f6af73f2abc73e5744520cfd9a6414e2f948e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/202762
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Andrey Logvin <landrey@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33108}
diff --git a/audio/BUILD.gn b/audio/BUILD.gn
index 1fea09c..467c2b6 100644
--- a/audio/BUILD.gn
+++ b/audio/BUILD.gn
@@ -220,8 +220,8 @@
"../test:test_support",
"../test/pc/e2e:network_quality_metrics_reporter",
"//testing/gtest",
- "//third_party/abseil-cpp/absl/flags:flag",
]
+ absl_deps = [ "//third_party/abseil-cpp/absl/flags:flag" ]
if (is_android) {
deps += [ "//testing/android/native_test:native_test_native_code" ]
}
diff --git a/common_video/BUILD.gn b/common_video/BUILD.gn
index bea8530..f7264e4 100644
--- a/common_video/BUILD.gn
+++ b/common_video/BUILD.gn
@@ -118,10 +118,11 @@
"../test:test_support",
"../test:video_test_common",
"//testing/gtest",
- "//third_party/abseil-cpp/absl/types:optional",
"//third_party/libyuv",
]
+ absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
+
data = common_video_resources
if (is_android) {
deps += [ "//testing/android/native_test:native_test_support" ]
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 4843b89..f19bd69 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -613,6 +613,8 @@
"../test:test_main",
"../test:test_support",
"../test:video_test_common",
+ ]
+ absl_deps = [
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings",
diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn
index ffd6027..9701270 100644
--- a/modules/audio_coding/BUILD.gn
+++ b/modules/audio_coding/BUILD.gn
@@ -1454,7 +1454,6 @@
defines = audio_coding_defines
deps = audio_coding_deps + [
- "//third_party/abseil-cpp/absl/strings",
"../../api/audio:audio_frame_api",
"../../rtc_base:checks",
":audio_coding",
@@ -1466,6 +1465,8 @@
"../../test:test_support",
"//testing/gtest",
]
+
+ absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}
audio_decoder_unittests_resources =
@@ -1657,8 +1658,6 @@
testonly = true
deps = audio_coding_deps + [
- "//third_party/abseil-cpp/absl/flags:flag",
- "//third_party/abseil-cpp/absl/flags:parse",
":audio_coding",
":audio_encoder_cng",
":neteq_input_audio_tools",
@@ -1670,6 +1669,8 @@
"../../api/audio_codecs/isac:audio_encoder_isac",
"../../api/audio_codecs/opus:audio_encoder_opus",
"../../rtc_base:safe_conversions",
+ "//third_party/abseil-cpp/absl/flags:flag",
+ "//third_party/abseil-cpp/absl/flags:parse",
"//third_party/abseil-cpp/absl/memory",
]
diff --git a/modules/video_coding/codecs/av1/BUILD.gn b/modules/video_coding/codecs/av1/BUILD.gn
index 95b5ad12..e7c901c 100644
--- a/modules/video_coding/codecs/av1/BUILD.gn
+++ b/modules/video_coding/codecs/av1/BUILD.gn
@@ -88,6 +88,7 @@
deps = [
":av1_svc_config",
"../../../../api/video_codecs:video_codecs_api",
+ "../../../../test:test_support",
]
if (enable_libaom) {
@@ -104,7 +105,6 @@
"../../../../api/units:data_size",
"../../../../api/units:time_delta",
"../../../../api/video:video_frame",
- "../../../../test:test_support",
"../../svc:scalability_structures",
"../../svc:scalable_video_controller",
]
diff --git a/rtc_tools/BUILD.gn b/rtc_tools/BUILD.gn
index bd90474..e629864 100644
--- a/rtc_tools/BUILD.gn
+++ b/rtc_tools/BUILD.gn
@@ -113,6 +113,12 @@
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
+# Abseil dependencies are not moved to the absl_deps field deliberately.
+# If build_with_chromium is true, the absl_deps replaces the dependencies with
+# the "//third_party/abseil-cpp:absl" target. Which doesn't include absl/flags
+# (and some others) because they cannot be used in Chromiums. Special exception
+# for the "frame_analyzer" target in "third_party/abseil-cpp/absl.gni" allows
+# it to be build in chromium.
rtc_executable("frame_analyzer") {
visibility = [ "*" ]
testonly = true
@@ -148,6 +154,13 @@
# This target can be built from Chromium but it doesn't support
# is_component_build=true because it depends on WebRTC testonly code
# which is not part of //third_party/webrtc_overrides:webrtc_component.
+
+ # Abseil dependencies are not moved to the absl_deps field deliberately.
+ # If build_with_chromium is true, the absl_deps replaces the dependencies with
+ # the "//third_party/abseil-cpp:absl" target. Which doesn't include absl/flags
+ # (and some others) because they cannot be used in Chromiums. Special exception
+ # for the "frame_analyzer" target in "third_party/abseil-cpp/absl.gni" allows
+ # it to be build in chromium.
rtc_executable("rtp_generator") {
visibility = [ "*" ]
testonly = true
@@ -201,6 +214,13 @@
# This target can be built from Chromium but it doesn't support
# is_component_build=true because it depends on WebRTC testonly code
# which is not part of //third_party/webrtc_overrides:webrtc_component.
+
+ # Abseil dependencies are not moved to the absl_deps field deliberately.
+ # If build_with_chromium is true, the absl_deps replaces the dependencies with
+ # the "//third_party/abseil-cpp:absl" target. Which doesn't include absl/flags
+ # (and some others) because they cannot be used in Chromiums. Special exception
+ # for the "frame_analyzer" target in "third_party/abseil-cpp/absl.gni" allows
+ # it to be build in chromium.
rtc_executable("video_replay") {
visibility = [ "*" ]
testonly = true
diff --git a/system_wrappers/BUILD.gn b/system_wrappers/BUILD.gn
index f44ff5b..de201d1 100644
--- a/system_wrappers/BUILD.gn
+++ b/system_wrappers/BUILD.gn
@@ -130,9 +130,10 @@
"../test:test_main",
"../test:test_support",
"//testing/gtest",
- "//third_party/abseil-cpp/absl/strings",
]
+ absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
+
if (is_android) {
deps += [ "//testing/android/native_test:native_test_support" ]
diff --git a/video/BUILD.gn b/video/BUILD.gn
index e7d4819..aa0852f 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -335,6 +335,7 @@
"../test:test_support",
]
}
+
rtc_library("video_quality_test") {
testonly = true
diff --git a/webrtc.gni b/webrtc.gni
index bf2343a..d57e1bf 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -475,6 +475,21 @@
xctest_module_target = "//base/test:google_test_runner"
}
}
+
+ # If absl_deps is [], no action is needed. If not [], then it needs to be
+ # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
+ # otherwise it just needs to be added to deps.
+ if (defined(absl_deps) && absl_deps != []) {
+ if (!defined(deps)) {
+ deps = []
+ }
+ if (build_with_chromium) {
+ deps += [ "//third_party/abseil-cpp:absl" ]
+ } else {
+ deps += absl_deps
+ }
+ }
+
if (using_sanitizer) {
if (is_linux) {
if (!defined(invoker.data)) {