From 41a7c5041ed91eeb6466769bfc5963a0604e7156 Mon Sep 17 00:00:00 2001 From: Dimiter 'malkia' Stanev Date: Mon, 26 Feb 2024 20:13:57 -0800 Subject: [PATCH] Remove duplicate, but unused downloads of googletest/benchmark, zlib 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 --- MODULE.bazel.lock | 54 +----------------------------------------- bazel/repositories.bzl | 50 ++++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 76 deletions(-) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 15ff0ed1..3a7538de 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -875,7 +875,7 @@ "moduleExtensions": { "//bazel:repositories.bzl%data_deps_ext": { "general": { - "bzlTransitiveDigest": "NzjsufYDx0sJg73LRkbiURCImjayNkfzMR3bq9ONl5o=", + "bzlTransitiveDigest": "xMW01TzlkedwiHLP/LDBVspDPj07WWgx5oqdDn7cbCc=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -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", diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 45082820..effa767a 100644 --- a/bazel/repositories.bzl +++ b/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", @@ -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", @@ -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( @@ -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,