Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion nodejs/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ def _download_node(repository_ctx):
sha256 = sha256,
))

# Return whether the download was reproducible
return sha256 != None

def _prepare_node(repository_ctx):
"""Sets up BUILD files and shell wrappers for the versions of Node.js, npm just set up.

Expand Down Expand Up @@ -309,9 +312,15 @@ def _verify_version_is_valid(version):
fail("Invalid node version: %s" % version)

def _nodejs_repositories_impl(repository_ctx):
_download_node(repository_ctx)
reproducible = _download_node(repository_ctx)
_prepare_node(repository_ctx)

# Bazel <8.3.0 lacks repository_ctx.repo_metadata
if not hasattr(repository_ctx, "repo_metadata"):
return None

return repository_ctx.repo_metadata(reproducible = reproducible)

_nodejs_repositories = repository_rule(
_nodejs_repositories_impl,
attrs = _ATTRS,
Expand Down