fix: add empty files to tar (#939)

This commit is contained in:
Sahin Yort 2024-09-17 17:05:20 -07:00 committed by GitHub
parent 3b6a3d50b1
commit 8f0b38004e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -234,12 +234,19 @@ def _mtree_impl(ctx):
workspace_name = str(ctx.workspace_name)
content.add(_mtree_line(runfiles_dir, type = "dir"))
content.add_all(
s.default_runfiles.empty_filenames,
format_each = "{}/%s".format(runfiles_dir),
# be careful about what you pass to map_each as it will carry the data structures over to execution phase.
map_each = lambda f, e: _mtree_line(_vis_encode(f.removeprefix("external/") if f.startswith("external/") else workspace_name + "/" + f), "file"),
allow_closure = True,
)
content.add_all(
s.default_runfiles.files,
expand_directories = True,
uniquify = True,
format_each = "{}/%s".format(runfiles_dir),
# be careful about what you pass to _expand_for_runfiles as it will carry the data structures over to execution phase.
# be careful about what you pass to map_each as it will carry the data structures over to execution phase.
map_each = lambda f, e: _expand(f, e, lambda f: _to_rlocation_path(f, workspace_name)),
allow_closure = True,
)