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 <orphis@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42382}
This commit is contained in:
Florent Castelli 2024-05-27 10:19:05 +00:00 committed by WebRTC LUCI CQ
parent 5237cbbe68
commit ae5d50320d
4 changed files with 43 additions and 73 deletions

View File

@ -16,12 +16,13 @@ adds the first use.
## How to depend on Abseil ## How to depend on Abseil
For build targets of type `rtc_library`, `rtc_source_set` and For build targets of type `rtc_library`, `rtc_source_set` and
`rtc_static_library`, dependencies on Abseil need to be listed in `absl_deps` `rtc_static_library`, dependencies on Abseil need to be listed in `deps`.
instead of `deps`.
This is needed in order to support the Abseil component build in Chromium. In The GN templates will take care of generating the proper dependency when
that build mode, WebRTC will depend on a monolithic Abseil build target that used within Chromium or standalone. In that build mode, WebRTC will depend
will generate a shared library. on a monolithic Abseil build target that will generate a shared library.
Previously, `absl_deps` was used but been deprecated in May 2024.
## **Allowed** ## **Allowed**

View File

@ -132,12 +132,6 @@ if (!is_component_build) {
# is_component_build=true because it depends on WebRTC testonly code # is_component_build=true because it depends on WebRTC testonly code
# which is not part of //third_party/webrtc_overrides:webrtc_component. # 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") { rtc_executable("frame_analyzer") {
visibility = [ "*" ] visibility = [ "*" ]
testonly = true testonly = true
@ -170,12 +164,6 @@ if (!is_component_build) {
# is_component_build=true because it depends on WebRTC testonly code # is_component_build=true because it depends on WebRTC testonly code
# which is not part of //third_party/webrtc_overrides:webrtc_component. # 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") { rtc_executable("rtp_generator") {
visibility = [ "*" ] visibility = [ "*" ]
testonly = true testonly = true
@ -237,12 +225,6 @@ if (!is_component_build) {
# is_component_build=true because it depends on WebRTC testonly code # is_component_build=true because it depends on WebRTC testonly code
# which is not part of //third_party/webrtc_overrides:webrtc_component. # 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") { rtc_executable("video_replay") {
visibility = [ "*" ] visibility = [ "*" ]
testonly = true testonly = true

View File

@ -55,8 +55,11 @@ template("webrtc_fuzzer_test") {
] ]
additional_configs = configs additional_configs = configs
# Convert Abseil dependencies to //third_party/abseil-cpp:absl when assert(
# build_with_chromium is true !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) { if (build_with_chromium) {
absl_dependencies = absl_dependencies =
filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ]) filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ])

View File

@ -413,28 +413,24 @@ set_defaults("rtc_test") {
configs = rtc_add_configs configs = rtc_add_configs
public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603) public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603)
suppressed_configs = [] suppressed_configs = []
absl_deps = []
} }
set_defaults("rtc_library") { set_defaults("rtc_library") {
configs = rtc_add_configs configs = rtc_add_configs
public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603) public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603)
suppressed_configs = [] suppressed_configs = []
absl_deps = []
} }
set_defaults("rtc_source_set") { set_defaults("rtc_source_set") {
configs = rtc_add_configs configs = rtc_add_configs
public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603) public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603)
suppressed_configs = [] suppressed_configs = []
absl_deps = []
} }
set_defaults("rtc_static_library") { set_defaults("rtc_static_library") {
configs = rtc_add_configs configs = rtc_add_configs
public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603) public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603)
suppressed_configs = [] suppressed_configs = []
absl_deps = []
} }
set_defaults("rtc_executable") { 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 assert(
# converted to //third_party/abseil-cpp:absl when build_with_chromium=true !defined(absl_deps),
# otherwise it just needs to be added to deps. "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.")
if (absl_deps != []) {
if (!defined(deps)) {
deps = []
}
deps += absl_deps
}
# Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true
if (build_with_chromium && defined(deps)) { 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 != []) { 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 = []
deps = filtered_deps deps = filtered_deps
deps += [ "//third_party/abseil-cpp:absl" ] deps += [ "//third_party/abseil-cpp:absl" ]
@ -682,20 +675,17 @@ template("rtc_source_set") {
public_configs += invoker.public_configs public_configs += invoker.public_configs
} }
# If absl_deps is [], no action is needed. If not [], then it needs to be assert(
# converted to //third_party/abseil-cpp:absl when build_with_chromium=true !defined(absl_deps),
# otherwise it just needs to be added to deps. "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.")
if (absl_deps != []) {
if (!defined(deps)) {
deps = []
}
deps += absl_deps
}
# Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true
if (build_with_chromium && defined(deps)) { 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 != []) { 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 = []
deps = filtered_deps deps = filtered_deps
deps += [ "//third_party/abseil-cpp:absl" ] deps += [ "//third_party/abseil-cpp:absl" ]
@ -777,20 +767,17 @@ template("rtc_static_library") {
public_configs += invoker.public_configs public_configs += invoker.public_configs
} }
# If absl_deps is [], no action is needed. If not [], then it needs to be assert(
# converted to //third_party/abseil-cpp:absl when build_with_chromium=true !defined(absl_deps),
# otherwise it just needs to be added to deps. "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.")
if (absl_deps != []) {
if (!defined(deps)) {
deps = []
}
deps += absl_deps
}
# Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true
if (build_with_chromium && defined(deps)) { 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 != []) { 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 = []
deps = filtered_deps deps = filtered_deps
deps += [ "//third_party/abseil-cpp:absl" ] deps += [ "//third_party/abseil-cpp:absl" ]
@ -922,20 +909,17 @@ template("rtc_library") {
public_configs += invoker.public_configs public_configs += invoker.public_configs
} }
# If absl_deps is [], no action is needed. If not [], then it needs to be assert(
# converted to //third_party/abseil-cpp:absl when build_with_chromium=true !defined(absl_deps),
# otherwise it just needs to be added to deps. "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.")
if (absl_deps != []) {
if (!defined(deps)) {
deps = []
}
deps += absl_deps
}
# Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true
if (build_with_chromium && defined(deps)) { 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 != []) { 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 = []
deps = filtered_deps deps = filtered_deps
deps += [ "//third_party/abseil-cpp:absl" ] deps += [ "//third_party/abseil-cpp:absl" ]