From 7864600a6ee3531652530b8fddad9bc49d20f3f7 Mon Sep 17 00:00:00 2001 From: Andrey Logvin Date: Fri, 29 Jan 2021 10:50:19 +0000 Subject: [PATCH] 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 Commit-Queue: Andrey Logvin Cr-Commit-Position: refs/heads/master@{#33108} --- audio/BUILD.gn | 2 +- common_video/BUILD.gn | 3 ++- media/BUILD.gn | 2 ++ modules/audio_coding/BUILD.gn | 7 ++++--- modules/video_coding/codecs/av1/BUILD.gn | 2 +- rtc_tools/BUILD.gn | 20 ++++++++++++++++++++ system_wrappers/BUILD.gn | 3 ++- video/BUILD.gn | 1 + webrtc.gni | 15 +++++++++++++++ 9 files changed, 48 insertions(+), 7 deletions(-) diff --git a/audio/BUILD.gn b/audio/BUILD.gn index 1fea09c209..467c2b6d24 100644 --- a/audio/BUILD.gn +++ b/audio/BUILD.gn @@ -220,8 +220,8 @@ if (rtc_include_tests) { "../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 bea8530860..f7264e4e82 100644 --- a/common_video/BUILD.gn +++ b/common_video/BUILD.gn @@ -118,10 +118,11 @@ if (rtc_include_tests) { "../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 4843b892cc..f19bd69229 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -613,6 +613,8 @@ if (rtc_include_tests) { "../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 ffd60279c3..9701270bde 100644 --- a/modules/audio_coding/BUILD.gn +++ b/modules/audio_coding/BUILD.gn @@ -1454,7 +1454,6 @@ if (rtc_include_tests) { 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 @@ if (rtc_include_tests) { "../../test:test_support", "//testing/gtest", ] + + absl_deps = [ "//third_party/abseil-cpp/absl/strings" ] } audio_decoder_unittests_resources = @@ -1657,8 +1658,6 @@ if (rtc_include_tests) { 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 @@ if (rtc_include_tests) { "../../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 95b5ad1274..e7c901cc9a 100644 --- a/modules/video_coding/codecs/av1/BUILD.gn +++ b/modules/video_coding/codecs/av1/BUILD.gn @@ -88,6 +88,7 @@ if (rtc_include_tests) { deps = [ ":av1_svc_config", "../../../../api/video_codecs:video_codecs_api", + "../../../../test:test_support", ] if (enable_libaom) { @@ -104,7 +105,6 @@ if (rtc_include_tests) { "../../../../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 bd90474689..e62986481f 100644 --- a/rtc_tools/BUILD.gn +++ b/rtc_tools/BUILD.gn @@ -113,6 +113,12 @@ rtc_library("video_quality_analysis") { 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 @@ if (!is_component_build) { # 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 @@ if (!is_component_build) { # 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 f44ff5b8bf..de201d197a 100644 --- a/system_wrappers/BUILD.gn +++ b/system_wrappers/BUILD.gn @@ -130,9 +130,10 @@ if (rtc_include_tests) { "../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 e7d48194da..aa0852fd16 100644 --- a/video/BUILD.gn +++ b/video/BUILD.gn @@ -335,6 +335,7 @@ if (rtc_include_tests) { "../test:test_support", ] } + rtc_library("video_quality_test") { testonly = true diff --git a/webrtc.gni b/webrtc.gni index bf2343a847..d57e1bf98d 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -475,6 +475,21 @@ template("rtc_test") { 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)) {