Skip to content

Commit

Permalink
feat(bzlmod): mark toolchains extension as reproducible (#970)
Browse files Browse the repository at this point in the history
  • Loading branch information
cerisier authored Dec 11, 2024
1 parent 8d07ac3 commit 1549b1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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)
6 changes: 6 additions & 0 deletions lib/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 1549b1f

Please sign in to comment.