Skip to content

Commit

Permalink
Remove duplicate, but unused downloads of googletest/benchmark, zlib …
Browse files Browse the repository at this point in the history
…and boringssl. This was due to function reused for both legacy repo download, and exposed as new bzlmod one. When it was used in the second case, these were pulled like: _main~data_deps_ext~zlib (and similar for the rest). The reduction is visible in the MODULE.bazel.lock file
  • Loading branch information
malkia committed Feb 27, 2024
1 parent 74e8ca1 commit 61ce6ca
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 76 deletions.
54 changes: 1 addition & 53 deletions MODULE.bazel.lock
Expand Up @@ -875,7 +875,7 @@
"moduleExtensions": {
"//bazel:repositories.bzl%data_deps_ext": {
"general": {
"bzlTransitiveDigest": "NzjsufYDx0sJg73LRkbiURCImjayNkfzMR3bq9ONl5o=",
"bzlTransitiveDigest": "xMW01TzlkedwiHLP/LDBVspDPj07WWgx5oqdDn7cbCc=",
"accumulatedFileDigests": {},
"envVariables": {},
"generatedRepoSpecs": {
Expand All @@ -892,58 +892,6 @@
"build_file": "@@//bazel:civetweb.BUILD"
}
},
"com_google_googletest": {
"bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl",
"ruleClassName": "http_archive",
"attributes": {
"name": "_main~data_deps_ext~com_google_googletest",
"sha256": "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2",
"strip_prefix": "googletest-release-1.12.1",
"urls": [
"https://github.com/google/googletest/archive/release-1.12.1.tar.gz"
]
}
},
"zlib": {
"bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl",
"ruleClassName": "http_archive",
"attributes": {
"name": "_main~data_deps_ext~zlib",
"sha256": "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30",
"strip_prefix": "zlib-1.2.13",
"urls": [
"https://mirror.bazel.build/zlib.net/zlib-1.2.13.tar.gz",
"https://zlib.net/zlib-1.2.13.tar.gz",
"https://storage.googleapis.com/bazel-mirror/zlib.net/zlib-1.2.13.tar.gz"
],
"build_file": "@@//bazel:zlib.BUILD"
}
},
"com_github_google_benchmark": {
"bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl",
"ruleClassName": "http_archive",
"attributes": {
"name": "_main~data_deps_ext~com_github_google_benchmark",
"sha256": "6bc180a57d23d4d9515519f92b0c83d61b05b5bab188961f36ac7b06b0d9e9ce",
"strip_prefix": "benchmark-1.8.3",
"urls": [
"https://github.com/google/benchmark/archive/v1.8.3.tar.gz"
]
}
},
"boringssl": {
"bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl",
"ruleClassName": "http_archive",
"attributes": {
"name": "_main~data_deps_ext~boringssl",
"sha256": "b21994a857a7aa6d5256ffe355c735ad4c286de44c6c81dfc04edc41a8feaeef",
"strip_prefix": "boringssl-2ff4b968a7e0cfee66d9f151cb95635b43dc1d5b",
"urls": [
"https://github.com/google/boringssl/archive/2ff4b968a7e0cfee66d9f151cb95635b43dc1d5b.tar.gz",
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/boringssl/archive/2ff4b968a7e0cfee66d9f151cb95635b43dc1d5b.tar.gz"
]
}
},
"com_github_curl": {
"bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl",
"ruleClassName": "http_archive",
Expand Down
50 changes: 27 additions & 23 deletions bazel/repositories.bzl
@@ -1,7 +1,7 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

def prometheus_cpp_repositories():
def _legacy_and_bzlmod_repositories():
maybe(
http_archive,
name = "civetweb",
Expand All @@ -13,16 +13,6 @@ def prometheus_cpp_repositories():
build_file = "@com_github_jupp0r_prometheus_cpp//bazel:civetweb.BUILD",
)

maybe(
http_archive,
name = "com_google_googletest",
sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2",
strip_prefix = "googletest-release-1.12.1",
urls = [
"https://github.com/google/googletest/archive/release-1.12.1.tar.gz",
],
)

maybe(
http_archive,
name = "com_github_curl",
Expand All @@ -35,27 +25,28 @@ def prometheus_cpp_repositories():
build_file = "@com_github_jupp0r_prometheus_cpp//bazel:curl.BUILD",
)

def prometheus_cpp_repositories():
_legacy_and_bzlmod_repositories()

# These legacy style repos have bzlmod support, they are re-added here for legacy support
maybe(
http_archive,
name = "com_github_google_benchmark",
sha256 = "6bc180a57d23d4d9515519f92b0c83d61b05b5bab188961f36ac7b06b0d9e9ce",
strip_prefix = "benchmark-1.8.3",
name = "com_google_googletest",
sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2",
strip_prefix = "googletest-release-1.12.1",
urls = [
"https://github.com/google/benchmark/archive/v1.8.3.tar.gz",
"https://github.com/google/googletest/archive/release-1.12.1.tar.gz",
],
)

maybe(
http_archive,
name = "zlib",
sha256 = "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30",
strip_prefix = "zlib-1.2.13",
name = "com_github_google_benchmark",
sha256 = "6bc180a57d23d4d9515519f92b0c83d61b05b5bab188961f36ac7b06b0d9e9ce",
strip_prefix = "benchmark-1.8.3",
urls = [
"https://mirror.bazel.build/zlib.net/zlib-1.2.13.tar.gz",
"https://zlib.net/zlib-1.2.13.tar.gz",
"https://storage.googleapis.com/bazel-mirror/zlib.net/zlib-1.2.13.tar.gz",
"https://github.com/google/benchmark/archive/v1.8.3.tar.gz",
],
build_file = "@com_github_jupp0r_prometheus_cpp//bazel:zlib.BUILD",
)

maybe(
Expand All @@ -71,8 +62,21 @@ def prometheus_cpp_repositories():
],
)

maybe(
http_archive,
name = "zlib",
sha256 = "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30",
strip_prefix = "zlib-1.2.13",
urls = [
"https://mirror.bazel.build/zlib.net/zlib-1.2.13.tar.gz",
"https://zlib.net/zlib-1.2.13.tar.gz",
"https://storage.googleapis.com/bazel-mirror/zlib.net/zlib-1.2.13.tar.gz",
],
build_file = "@com_github_jupp0r_prometheus_cpp//bazel:zlib.BUILD",
)

def _data_deps_extension_impl(ctx):
prometheus_cpp_repositories()
_legacy_and_bzlmod_repositories()

data_deps_ext = module_extension(
implementation = _data_deps_extension_impl,
Expand Down

0 comments on commit 61ce6ca

Please sign in to comment.