Skip to content

Commit

Permalink
Add absl_deps field for rtc_test and rtc_executable
Browse files Browse the repository at this point in the history
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 <[email protected]>
Commit-Queue: Andrey Logvin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#33108}
  • Loading branch information
Andrey Logvin authored and Commit Bot committed Jan 29, 2021
1 parent b79acd8 commit 7864600
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 7 deletions.
2 changes: 1 addition & 1 deletion audio/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}
Expand Down
3 changes: 2 additions & 1 deletion common_video/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down
2 changes: 2 additions & 0 deletions media/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 4 additions & 3 deletions modules/audio_coding/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 =
Expand Down Expand Up @@ -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",
Expand All @@ -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",
]

Expand Down
2 changes: 1 addition & 1 deletion modules/video_coding/codecs/av1/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ if (rtc_include_tests) {
deps = [
":av1_svc_config",
"../../../../api/video_codecs:video_codecs_api",
"../../../../test:test_support",
]

if (enable_libaom) {
Expand All @@ -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",
]
Expand Down
20 changes: 20 additions & 0 deletions rtc_tools/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion system_wrappers/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]

Expand Down
1 change: 1 addition & 0 deletions video/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ if (rtc_include_tests) {
"../test:test_support",
]
}

rtc_library("video_quality_test") {
testonly = true

Expand Down
15 changes: 15 additions & 0 deletions webrtc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 7864600

Please sign in to comment.