0005.patch (2748B)
1 From: Michael Froman <mfroman@mozilla.com> 2 Date: Thu, 10 Oct 2024 13:42:00 +0000 3 Subject: Bug 1921707 - absl.gni - filter dep paths from 4 '//third_party/abseil-cpp/' to '//' r=ng 5 6 Differential Revision: https://phabricator.services.mozilla.com/D224080 7 Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/afc78fbdb5666ffa9c87da7427cc7249220f4908 8 --- 9 abseil-cpp/absl.gni | 54 ++++++++++++++++++++++++++++++++++++++++++++- 10 1 file changed, 53 insertions(+), 1 deletion(-) 11 12 diff --git a/abseil-cpp/absl.gni b/abseil-cpp/absl.gni 13 index ff2ff91cfa4..1213d0e0bb0 100644 14 --- a/abseil-cpp/absl.gni 15 +++ b/abseil-cpp/absl.gni 16 @@ -79,8 +79,45 @@ template("absl_source_set") { 17 visibility = [ "*" ] 18 } 19 } 20 + visibility += [ "//abseil-cpp/*" ] 21 + 22 + # Now that abseil-cpp lives under Mozilla's third_party instead 23 + # of under libwebrtc's third_party and is built as a stand-alone 24 + # library, we need to "re-root" the dependency paths. We can 25 + # modify the dependencies here to avoid modifying most, if not 26 + # all, of the BUILD.gn files. 27 + if (defined(deps)) { 28 + modified_deps = [] 29 + foreach (dep, deps) { 30 + newdep = string_replace(dep, "//third_party/abseil-cpp/", "//") 31 + modified_deps += [ newdep ] 32 + } 33 + deps = [] 34 + deps = modified_deps 35 + } 36 + 37 + # Same for public_deps 38 + if (defined(public_deps)) { 39 + modified_deps = [] 40 + foreach (dep, public_deps) { 41 + newdep = string_replace(dep, "//third_party/abseil-cpp/", "//") 42 + modified_deps += [ newdep ] 43 + } 44 + public_deps = [] 45 + public_deps = modified_deps 46 + } 47 + 48 + # Same for visibility 49 + if (defined(visibility)) { 50 + modified_deps = [] 51 + foreach (dep, visibility) { 52 + newdep = string_replace(dep, "//third_party/abseil-cpp/", "//") 53 + modified_deps += [ newdep ] 54 + } 55 + visibility = [] 56 + visibility = modified_deps 57 + } 58 } 59 - visibility += [ "//abseil-cpp/*" ] 60 } 61 } 62 63 @@ -110,5 +147,20 @@ template("absl_test") { 64 "//third_party/googletest:gtest", 65 ] 66 } 67 + 68 + # Now that abseil-cpp lives under Mozilla's third_party instead 69 + # of under libwebrtc's third_party and is built as a stand-alone 70 + # library, we need to "re-root" the dependency paths. We can 71 + # modify the dependencies here to avoid modifying most, if not 72 + # all, of the BUILD.gn files. 73 + if (defined(deps)) { 74 + modified_deps = [] 75 + foreach (dep, deps) { 76 + newdep = string_replace(dep, "//third_party/abseil-cpp/", "//") 77 + modified_deps += [ newdep ] 78 + } 79 + deps = [] 80 + deps = modified_deps 81 + } 82 } 83 }