From: Michael Froman Date: Thu, 10 Oct 2024 13:42:00 +0000 Subject: Bug 1921707 - absl.gni - filter dep paths from '//third_party/abseil-cpp/' to '//' r=ng Differential Revision: https://phabricator.services.mozilla.com/D224080 Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/afc78fbdb5666ffa9c87da7427cc7249220f4908 --- abseil-cpp/absl.gni | 54 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/abseil-cpp/absl.gni b/abseil-cpp/absl.gni index ff2ff91cfa4..1213d0e0bb0 100644 --- a/abseil-cpp/absl.gni +++ b/abseil-cpp/absl.gni @@ -79,8 +79,45 @@ template("absl_source_set") { visibility = [ "*" ] } } + 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 + } } - visibility += [ "//abseil-cpp/*" ] } } @@ -110,5 +147,20 @@ template("absl_test") { "//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 + } } }