Skip to content

Commit 8fdff67

Browse files
feat: add support for --repo_contents_cache (#1705)
Support https://bazel.build/reference/command-line-reference#common_options-flag--repo_contents_cache. Signed-off-by: Brentley Jones <github@brentleyjones.com>
1 parent c982d10 commit 8fdff67

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

swiftpkg/internal/swift_package.bzl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,23 @@ def _swift_package_impl(repository_ctx):
8383
# Remove unused modulemaps to prevent module redefinition errors
8484
repo_rules.remove_modulemaps(repository_ctx, directory, pkg_ctx.pkg_info.targets)
8585

86+
has_repo_metadata = hasattr(repository_ctx, "repo_metadata")
87+
if has_repo_metadata and repository_ctx.attr.commit:
88+
return repository_ctx.repo_metadata(reproducible = True)
89+
8690
# Return attributes that make this reproducible
87-
return _update_git_attrs(repository_ctx.attr, _ALL_ATTRS.keys(), update)
91+
attrs_for_reproducibility = _update_git_attrs(
92+
repository_ctx.attr,
93+
_ALL_ATTRS.keys(),
94+
update,
95+
)
96+
97+
if has_repo_metadata:
98+
return repository_ctx.repo_metadata(
99+
attrs_for_reproducibility = attrs_for_reproducibility,
100+
)
101+
else:
102+
return attrs_for_reproducibility
88103

89104
_GIT_ATTRS = {
90105
"branch": attr.string(

0 commit comments

Comments
 (0)