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 authored and gjasny committed Mar 2, 2024
1 parent 5295636 commit 41a7c50
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 27 additions & 23 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
@@ -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 41a7c50

Please sign in to comment.