Skip to content

Commit 979bc93

Browse files
authored
fix: Mark internal config repo as reproducible for Bzlmod (bazel-contrib#3544)
When I updated past 1.6.3, I noticed that my MODULE.bazel.lock was being updated with locking details of the internal dependencies of rules_python. My understanding is that `http_archive` and non-watched repository files tend to be easy to mark reproducible, which avoids unnecessary updates to the lockfile. I have verified this on an internal project that this does what I expect it to.
1 parent 89f7062 commit 979bc93

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

python/extensions/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ bzl_library(
4747
deps = [
4848
"//python/private:internal_config_repo_bzl",
4949
"//python/private/pypi:deps_bzl",
50+
"@bazel_features//:features",
5051
],
5152
)

python/extensions/config.bzl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Extension for configuring global settings of rules_python."""
22

3+
load("@bazel_features//:features.bzl", "bazel_features")
34
load("//python/private:internal_config_repo.bzl", "internal_config_repo")
45
load("//python/private/pypi:deps.bzl", "pypi_deps")
56

@@ -21,10 +22,10 @@ to repositories that are expensive to create or invalidate frequently.
2122
},
2223
)
2324

24-
def _config_impl(mctx):
25+
def _config_impl(module_ctx):
2526
transition_setting_generators = {}
2627
transition_settings = []
27-
for mod in mctx.modules:
28+
for mod in module_ctx.modules:
2829
for tag in mod.tags.add_transition_setting:
2930
setting = str(tag.setting)
3031
if setting not in transition_setting_generators:
@@ -40,6 +41,11 @@ def _config_impl(mctx):
4041

4142
pypi_deps()
4243

44+
if bazel_features.external_deps.extension_metadata_has_reproducible:
45+
return module_ctx.extension_metadata(reproducible = True)
46+
else:
47+
return None
48+
4349
config = module_extension(
4450
doc = """Global settings for rules_python.
4551

0 commit comments

Comments
 (0)