Bug 1921707 - absl.gni - filter dep paths from '//third_party/abseil-cpp/' to '//' r=ng

Differential Revision: https://phabricator.services.mozilla.com/D224080
This commit is contained in:
Michael Froman 2024-10-10 13:42:41 +00:00
parent c79b99bfb1
commit a78c79499e

View File

@ -86,6 +86,43 @@ template("absl_source_set") {
}
}
visibility += [ "//abseil-cpp/*" ]
# Now that abseil-cpp lives under Mozilla's third_party instead
# of under libwebrtc's third_party and is built as a stand-alone
# library, we need to "re-root" the dependency paths. We can
# modify the dependencies here to avoid modifying most, if not
# all, of the BUILD.gn files.
if (defined(deps)) {
modified_deps = []
foreach (dep, deps) {
newdep = string_replace(dep, "//third_party/abseil-cpp/", "//")
modified_deps += [ newdep ]
}
deps = []
deps = modified_deps
}
# Same for public_deps
if (defined(public_deps)) {
modified_deps = []
foreach (dep, public_deps) {
newdep = string_replace(dep, "//third_party/abseil-cpp/", "//")
modified_deps += [ newdep ]
}
public_deps = []
public_deps = modified_deps
}
# Same for visibility
if (defined(visibility)) {
modified_deps = []
foreach (dep, visibility) {
newdep = string_replace(dep, "//third_party/abseil-cpp/", "//")
modified_deps += [ newdep ]
}
visibility = []
visibility = modified_deps
}
}
}
@ -111,5 +148,20 @@ template("absl_test") {
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
]
# Now that abseil-cpp lives under Mozilla's third_party instead
# of under libwebrtc's third_party and is built as a stand-alone
# library, we need to "re-root" the dependency paths. We can
# modify the dependencies here to avoid modifying most, if not
# all, of the BUILD.gn files.
if (defined(deps)) {
modified_deps = []
foreach (dep, deps) {
newdep = string_replace(dep, "//third_party/abseil-cpp/", "//")
modified_deps += [ newdep ]
}
deps = []
deps = modified_deps
}
}
}