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

fix: access FilesToRunProvider.repo_mapping_manifest indirectly #976

Merged
merged 1 commit into from
Nov 6, 2024
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
9 changes: 7 additions & 2 deletions lib/private/tar.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ def _configured_unused_inputs_file(ctx, srcs, keep):

return unused_inputs


# TODO(3.0): Access field directly after minimum bazel_compatibility advanced to or beyond v7.0.0.
def _repo_mapping_manifest(files_to_run):
return getattr(files_to_run, "repo_mapping_manifest", None)

def _tar_impl(ctx):
bsdtar = ctx.toolchains[TAR_TOOLCHAIN_TYPE]
inputs = ctx.files.srcs[:]
Expand All @@ -301,7 +306,7 @@ def _tar_impl(ctx):
inputs.append(ctx.file.mtree)

repo_mappings = [
src[DefaultInfo].files_to_run.repo_mapping_manifest
_repo_mapping_manifest(src[DefaultInfo].files_to_run)
thesayyn marked this conversation as resolved.
Show resolved Hide resolved
for src in ctx.attr.srcs
]
repo_mappings = [m for m in repo_mappings if m != None]
Expand Down Expand Up @@ -411,7 +416,7 @@ def _mtree_impl(ctx):
continue

runfiles_dir = _calculate_runfiles_dir(default_info)
repo_mapping = default_info.files_to_run.repo_mapping_manifest
repo_mapping = _repo_mapping_manifest(default_info.files_to_run)

# copy workspace name here just in case to prevent ctx
# to be transferred to execution phase.
Expand Down
Loading