From 7fa649c5d1984c99987daff2f4aa9be0c9f49da9 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Fri, 22 Mar 2024 12:37:55 +0100 Subject: [PATCH] Mark `go_deps` extension as reproducible This removes the duplication of Go dependency information between `go.mod`/`go.sum` and `MODULE.bazel.lock`. --- MODULE.bazel | 1 + internal/bzlmod/go_deps.bzl | 5 +++++ tests/bcr/.bazelversion | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index 4ed18fe1f..ba9c3c66b 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,6 +4,7 @@ module( repo_name = "bazel_gazelle", ) +bazel_dep(name = "bazel_features", version = "1.9.0") bazel_dep(name = "bazel_skylib", version = "1.5.0") bazel_dep(name = "protobuf", version = "3.19.6", repo_name = "com_google_protobuf") bazel_dep(name = "rules_go", version = "0.44.0", repo_name = "io_bazel_rules_go") diff --git a/internal/bzlmod/go_deps.bzl b/internal/bzlmod/go_deps.bzl index 566781920..7f0c3d577 100644 --- a/internal/bzlmod/go_deps.bzl +++ b/internal/bzlmod/go_deps.bzl @@ -28,6 +28,7 @@ load( "get_directive_value", "with_replaced_or_new_fields", ) +load("@bazel_features//:features.bzl", "bazel_features") visibility("//") @@ -553,6 +554,9 @@ def _go_deps_impl(module_ctx): go_env = go_env, ) + metadata_kwargs = {} + if bazel_features.external_deps.extension_metadata_has_reproducible: + metadata_kwargs["reproducible"] = True return _extension_metadata( module_ctx, root_module_direct_deps = root_module_direct_deps.keys(), @@ -563,6 +567,7 @@ def _go_deps_impl(module_ctx): for repo_name in root_module_direct_dev_deps.keys() if repo_name not in root_module_direct_deps }.keys(), + **metadata_kwargs ) def _get_sum_from_module(path, module, sums): diff --git a/tests/bcr/.bazelversion b/tests/bcr/.bazelversion index a8907c025..21c8c7b46 100644 --- a/tests/bcr/.bazelversion +++ b/tests/bcr/.bazelversion @@ -1 +1 @@ -7.0.2 +7.1.1