From 8557ef43b75264bf5c3ea3bed0c545333ddf945a Mon Sep 17 00:00:00 2001 From: Corentin Kerisit Date: Tue, 22 Oct 2024 00:05:26 +0200 Subject: [PATCH] feat(bzlmod): mark toolchains extension as reproducible --- MODULE.bazel | 2 +- lib/extensions.bzl | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index c5135a0..27c7884 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -8,6 +8,7 @@ module( ) # Lower-bounds (minimum) versions for direct runtime dependencies +bazel_dep(name = "bazel_features", version = "1.9.0") bazel_dep(name = "bazel_skylib", version = "1.5.0") bazel_dep(name = "platforms", version = "0.0.10") @@ -79,4 +80,3 @@ use_repo(host_platform, "host_platform") bazel_dep(name = "aspect_rules_lint", version = "1.0.0-rc10", dev_dependency = True) bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True) bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True) -bazel_dep(name = "bazel_features", version = "0.2.0", dev_dependency = True) diff --git a/lib/extensions.bzl b/lib/extensions.bzl index 635c922..f32c882 100644 --- a/lib/extensions.bzl +++ b/lib/extensions.bzl @@ -25,6 +25,7 @@ load( "register_yq_toolchains", "register_zstd_toolchains", ) +load("@bazel_features//:features.bzl", "bazel_features") load("//lib/private:extension_utils.bzl", "extension_utils") load("//lib/private:host_repo.bzl", "host_repo") @@ -117,6 +118,11 @@ def _toolchains_extension_impl(mctx): get_version_fn = lambda attr: attr.core_version, ) + if bazel_features.external_deps.extension_metadata_has_reproducible: + return mctx.extension_metadata(reproducible = True) + + return mctx.extension_metadata() + toolchains = module_extension( implementation = _toolchains_extension_impl, tag_classes = {