Skip to content

Commit e55e899

Browse files
authored
chore: Mark nodejs_repositories repo rule as reproducible (#3896)
Marking this repo rule as reproducible opts it in to using the remote repository content cache, allowing users to avoid materializing it locally
1 parent 5b134f8 commit e55e899

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

nodejs/repositories.bzl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ def _download_node(repository_ctx):
119119
sha256 = sha256,
120120
))
121121

122+
# Return whether the download was reproducible
123+
return sha256 != None
124+
122125
def _prepare_node(repository_ctx):
123126
"""Sets up BUILD files and shell wrappers for the versions of Node.js, npm just set up.
124127
@@ -309,9 +312,15 @@ def _verify_version_is_valid(version):
309312
fail("Invalid node version: %s" % version)
310313

311314
def _nodejs_repositories_impl(repository_ctx):
312-
_download_node(repository_ctx)
315+
reproducible = _download_node(repository_ctx)
313316
_prepare_node(repository_ctx)
314317

318+
# Bazel <8.3.0 lacks repository_ctx.repo_metadata
319+
if not hasattr(repository_ctx, "repo_metadata"):
320+
return None
321+
322+
return repository_ctx.repo_metadata(reproducible = reproducible)
323+
315324
_nodejs_repositories = repository_rule(
316325
_nodejs_repositories_impl,
317326
attrs = _ATTRS,

0 commit comments

Comments
 (0)