From ae5d50320dcee86ee8b5d4c0b634efb1fe6d69f7 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Mon, 27 May 2024 10:19:05 +0000 Subject: [PATCH] Deprecate `absl_deps` in templates and update documentation. Bug: webrtc:341803749 Change-Id: I1ea6a2160c9a1d6d15a4f5e83f37d53f42215746 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352200 Auto-Submit: Florent Castelli Commit-Queue: Mirko Bonadei Commit-Queue: Florent Castelli Reviewed-by: Mirko Bonadei Cr-Commit-Position: refs/heads/main@{#42382} --- g3doc/abseil-in-webrtc.md | 11 +++--- rtc_tools/BUILD.gn | 18 --------- test/fuzzers/BUILD.gn | 7 +++- webrtc.gni | 80 ++++++++++++++++----------------------- 4 files changed, 43 insertions(+), 73 deletions(-) diff --git a/g3doc/abseil-in-webrtc.md b/g3doc/abseil-in-webrtc.md index 034f6c2fb4..a5803ff653 100644 --- a/g3doc/abseil-in-webrtc.md +++ b/g3doc/abseil-in-webrtc.md @@ -16,12 +16,13 @@ adds the first use. ## How to depend on Abseil For build targets of type `rtc_library`, `rtc_source_set` and -`rtc_static_library`, dependencies on Abseil need to be listed in `absl_deps` -instead of `deps`. +`rtc_static_library`, dependencies on Abseil need to be listed in `deps`. -This is needed in order to support the Abseil component build in Chromium. In -that build mode, WebRTC will depend on a monolithic Abseil build target that -will generate a shared library. +The GN templates will take care of generating the proper dependency when +used within Chromium or standalone. In that build mode, WebRTC will depend +on a monolithic Abseil build target that will generate a shared library. + +Previously, `absl_deps` was used but been deprecated in May 2024. ## **Allowed** diff --git a/rtc_tools/BUILD.gn b/rtc_tools/BUILD.gn index 20eb537473..e27145b1be 100644 --- a/rtc_tools/BUILD.gn +++ b/rtc_tools/BUILD.gn @@ -132,12 +132,6 @@ if (!is_component_build) { # 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("frame_analyzer") { visibility = [ "*" ] testonly = true @@ -170,12 +164,6 @@ if (!is_component_build) { # 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 "rtp_generator" target in "third_party/abseil-cpp/absl.gni" allows - # it to be build in chromium. rtc_executable("rtp_generator") { visibility = [ "*" ] testonly = true @@ -237,12 +225,6 @@ if (!is_component_build) { # 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 "video_replay" 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/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn index 5dd25b400c..1785740f89 100644 --- a/test/fuzzers/BUILD.gn +++ b/test/fuzzers/BUILD.gn @@ -55,8 +55,11 @@ template("webrtc_fuzzer_test") { ] additional_configs = configs - # Convert Abseil dependencies to //third_party/abseil-cpp:absl when - # build_with_chromium is true + assert( + !defined(absl_deps), + "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.") + + # Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true if (build_with_chromium) { absl_dependencies = filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ]) diff --git a/webrtc.gni b/webrtc.gni index 860a69b7eb..0e3487e715 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -413,28 +413,24 @@ set_defaults("rtc_test") { configs = rtc_add_configs public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603) suppressed_configs = [] - absl_deps = [] } 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") { @@ -562,20 +558,17 @@ template("rtc_test") { } } - # 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 (absl_deps != []) { - if (!defined(deps)) { - deps = [] - } - deps += absl_deps - } + assert( + !defined(absl_deps), + "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.") + # Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true if (build_with_chromium && defined(deps)) { - absl_dependencies = filter_labels_include(deps, ["//third_party/abseil-cpp/*"]) + absl_dependencies = + filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ]) if (absl_dependencies != []) { - filtered_deps = filter_labels_exclude(deps, ["//third_party/abseil-cpp/*"]) + filtered_deps = + filter_labels_exclude(deps, [ "//third_party/abseil-cpp/*" ]) deps = [] deps = filtered_deps deps += [ "//third_party/abseil-cpp:absl" ] @@ -682,20 +675,17 @@ template("rtc_source_set") { public_configs += invoker.public_configs } - # 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 (absl_deps != []) { - if (!defined(deps)) { - deps = [] - } - deps += absl_deps - } + assert( + !defined(absl_deps), + "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.") + # Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true if (build_with_chromium && defined(deps)) { - absl_dependencies = filter_labels_include(deps, ["//third_party/abseil-cpp/*"]) + absl_dependencies = + filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ]) if (absl_dependencies != []) { - filtered_deps = filter_labels_exclude(deps, ["//third_party/abseil-cpp/*"]) + filtered_deps = + filter_labels_exclude(deps, [ "//third_party/abseil-cpp/*" ]) deps = [] deps = filtered_deps deps += [ "//third_party/abseil-cpp:absl" ] @@ -777,20 +767,17 @@ template("rtc_static_library") { public_configs += invoker.public_configs } - # 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 (absl_deps != []) { - if (!defined(deps)) { - deps = [] - } - deps += absl_deps - } + assert( + !defined(absl_deps), + "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.") + # Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true if (build_with_chromium && defined(deps)) { - absl_dependencies = filter_labels_include(deps, ["//third_party/abseil-cpp/*"]) + absl_dependencies = + filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ]) if (absl_dependencies != []) { - filtered_deps = filter_labels_exclude(deps, ["//third_party/abseil-cpp/*"]) + filtered_deps = + filter_labels_exclude(deps, [ "//third_party/abseil-cpp/*" ]) deps = [] deps = filtered_deps deps += [ "//third_party/abseil-cpp:absl" ] @@ -922,20 +909,17 @@ template("rtc_library") { public_configs += invoker.public_configs } - # 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 (absl_deps != []) { - if (!defined(deps)) { - deps = [] - } - deps += absl_deps - } + assert( + !defined(absl_deps), + "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.") + # Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true if (build_with_chromium && defined(deps)) { - absl_dependencies = filter_labels_include(deps, ["//third_party/abseil-cpp/*"]) + absl_dependencies = + filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ]) if (absl_dependencies != []) { - filtered_deps = filter_labels_exclude(deps, ["//third_party/abseil-cpp/*"]) + filtered_deps = + filter_labels_exclude(deps, [ "//third_party/abseil-cpp/*" ]) deps = [] deps = filtered_deps deps += [ "//third_party/abseil-cpp:absl" ]