Skip to content

Commit e0fbb71

Browse files
cerisierUebelAndre
andauthored
Mark cargo internal extension as reproducible (#3237)
Since all repo from cargo_repositories are instantiated with the same attribute values. Saves an entry in the lockfile. --------- Co-authored-by: UebelAndre <github@uebelandre.com>
1 parent b896f86 commit e0fbb71

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

cargo/private/internal_extensions.bzl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Bzlmod module extensions that are only used internally"""
22

3+
load("@bazel_features//:features.bzl", "bazel_features")
34
load("//cargo:deps.bzl", "cargo_dependencies")
45

56
def _internal_deps_impl(module_ctx):
@@ -12,10 +13,15 @@ def _internal_deps_impl(module_ctx):
1213
# is_dev_dep is ignored here. It's not relevant for internal_deps, as dev
1314
# dependencies are only relevant for module extensions that can be used
1415
# by other MODULES.
15-
return module_ctx.extension_metadata(
16-
root_module_direct_deps = [repo.repo for repo in direct_deps],
17-
root_module_direct_dev_deps = [],
18-
)
16+
metadata_kwargs = {
17+
"root_module_direct_deps": [repo.repo for repo in direct_deps],
18+
"root_module_direct_dev_deps": [],
19+
}
20+
21+
if bazel_features.external_deps.extension_metadata_has_reproducible:
22+
metadata_kwargs["reproducible"] = True
23+
24+
return module_ctx.extension_metadata(**metadata_kwargs)
1925

2026
# This is named a single character to reduce the size of path names when running build scripts, to reduce the chance
2127
# of hitting the 260 character windows path name limit.

0 commit comments

Comments
 (0)