Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bzlmod): mark lock_import and lock_repos as reproducible #99

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module(
)

bazel_dep(name = "aspect_bazel_lib", version = "1.38.1")
bazel_dep(name = "bazel_features", version = "1.1.1")
bazel_dep(name = "bazel_features", version = "1.11.0")
bazel_dep(name = "bazel_skylib", version = "1.4.2")
bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "rules_python", version = "0.29.0")
Expand Down
2 changes: 2 additions & 0 deletions pycross/private/bzlmod/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ bzl_library(
"//pycross/private:poetry_lock_model",
"//pycross/private:pypi_file",
"//pycross/private:resolved_lock_repo",
"@bazel_features//:features",
] + REPO_HTTP_DEPS,
)

Expand All @@ -61,6 +62,7 @@ bzl_library(
":tag_attrs",
"//pycross/private:package_repo",
"//pycross/private:pypi_file",
"@bazel_features//:features",
"@lock_import_repos_hub//:locks.bzl",
] + REPO_HTTP_DEPS,
)
Expand Down
5 changes: 5 additions & 0 deletions pycross/private/bzlmod/lock_import.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""The lock_import extension."""

load("@bazel_features//:features.bzl", "bazel_features")
load("//pycross/private:lock_attrs.bzl", "package_annotation")
load("//pycross/private:pdm_lock_model.bzl", "lock_repo_model_pdm")
load("//pycross/private:poetry_lock_model.bzl", "lock_repo_model_poetry")
Expand Down Expand Up @@ -128,6 +129,10 @@ def _lock_import_impl(module_ctx):
repo_files = resolved_lock_files,
)

if bazel_features.external_deps.extension_metadata_has_reproducible:
return module_ctx.extension_metadata(reproducible = True)
return module_ctx.extension_metadata()

# Tag classes
_import_pdm_tag = tag_class(
doc = "Import a PDM lock file.",
Expand Down
5 changes: 5 additions & 0 deletions pycross/private/bzlmod/lock_repos.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""The lock_repos extension."""

load("@bazel_features//:features.bzl", "bazel_features")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
load("@lock_import_repos_hub//:locks.bzl", lock_import_locks = "locks")
load("//pycross/private:package_repo.bzl", "package_repo")
Expand Down Expand Up @@ -82,6 +83,10 @@ def _lock_repos_impl(module_ctx):
repo_map = repo_remote_files,
)

if bazel_features.external_deps.extension_metadata_has_reproducible:
return module_ctx.extension_metadata(reproducible = True)
return module_ctx.extension_metadata()

# Tag classes
_create_tag = tag_class(
doc = "Create declared Pycross repos.",
Expand Down
Loading