diff options
author | Christian Verkerk <christian@tubularlabs.com> | 2018-05-29 08:27:40 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-05-29 08:29:04 -0700 |
commit | f90ed652e223fffdf3f64cf1d9f49663be540b18 (patch) | |
tree | 96d6c6aa9c723bea67ff25ad38db4022637f6503 /tools | |
parent | 45c2dce449eb7d4b0934471c3d8a8bd3bc635f31 (diff) |
Add ability to add runfiles to tar
Closes #5044.
PiperOrigin-RevId: 198399012
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build_defs/pkg/pkg.bzl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/build_defs/pkg/pkg.bzl b/tools/build_defs/pkg/pkg.bzl index 569c8c85a1..8cbe03ceec 100644 --- a/tools/build_defs/pkg/pkg.bzl +++ b/tools/build_defs/pkg/pkg.bzl @@ -31,9 +31,18 @@ def _pkg_tar_impl(ctx): "--owner=" + ctx.attr.owner, "--owner_name=" + ctx.attr.ownername, ] + file_inputs = ctx.files.srcs[:] + + # Add runfiles if requested + if ctx.attr.include_runfiles: + for f in ctx.attr.srcs: + if hasattr(f, "default_runfiles"): + run_files = f.default_runfiles.files.to_list() + file_inputs += run_files + args += ["--file=%s=%s" % (f.path, dest_path(f, data_path)) - for f in ctx.files.srcs] + for f in file_inputs] for target, f_dest_path in ctx.attr.files.items(): target_files = target.files.to_list() if len(target_files) != 1: @@ -180,6 +189,7 @@ _real_pkg_tar = rule( "extension": attr.string(default="tar"), "symlinks": attr.string_dict(), "empty_files": attr.string_list(), + "include_runfiles": attr.bool(default=False, mandatory=False), "empty_dirs": attr.string_list(), # Implicit dependencies. "build_tar": attr.label( |