Documentation Index
Fetch the complete documentation index at: https://docs.aspect.build/llms.txt
Use this file to discover all available pages before exploring further.
Documentation for @tar.bzl@v0.8.1 — View source
Examples
pigz will greatly improve the performance.
- Add
pigzinMODULE.bazel; see https://registry.bazel.build/modules/pigz - Use the new tar compressor attribute in your BUILD file, eg:
Rule: tar_rule
Rule that executes BSD tar. Most users should use the tar macro, rather than load this directly.
Attributes
A unique name for this target.
Additional flags permitted by BSD tar; see the man page.
Files, directories, or other targets whose default outputs are placed into the tar.If any of the srcs are binaries with runfiles, those are copied into the resulting tar as well.
A mode indicator from the following list, copied from the tar manpage:
- create: Create a new archive containing the specified items.
An mtree specification file
Resulting tar file to write. If absent,
[name].tar is written.Compress the archive file with a supported algorithm.Default is
"" which means no compression.External tool which can compress the archive.
Arg list for
compressor.Whether to discover and prune input files that will not contribute to the archive.Unused inputs are discovered by comparing the set of input files in
srcs to the set
of files referenced by mtree. Files not used for content by the mtree specification
will not be read by the tar tool when creating the archive and can be pruned from the
input set using the unused_inputs_list
mechanism.Benefits: pruning unused input files can reduce the amount of work the build system must
perform. Pruned files are not included in the (local)action cache key; changes to them do
not invalidate the cache entry, which can lead to higher cache hit rates. Actions do not
need to block on the availability of pruned inputs, which can increase the available
parallelism of builds.Risks: pruning an actually-used input file can lead to unexpected, incorrect results. The
comparison performed between srcs and mtree is currently inexact and may fail to
handle handwritten or externally-derived mtree specifications. However, it is safe to use
this feature when the lines found in mtree are derived from one or more mtree_spec
rules, filtered and/or merged on whole-line basis only.Possible values:compute_unused_inputs = 1: Always perform unused input discovery and pruning.compute_unused_inputs = 0: Never discover or prune unused inputs.compute_unused_inputs = -1: Discovery and pruning of unused inputs is controlled by the —[no]@tar.bzl//tar:tar_compute_unused_inputs flag.
Function: tar_lib.common.add_compression_args
Parameters
Function: tar_lib.implementation
Parameters
Function: tar_lib.mtree_implementation
Parameters
Function: tar
Wrapper macro around tar_rule.
Options for mtree
mtree provides the “specification” or manifest of a tar file. See https://man.freebsd.org/cgi/man.cgi?mtree(8) Because BSD tar doesn’t have a flag to set modification times to a constant, we must always supply an mtree input to get reproducible builds. See https://reproducible-builds.org/docs/archives/ for more explanation.-
By default, mtree is “auto” which causes the macro to create an
mtree_specrule. -
mtreemay be supplied as an array literal of lines, e.g.
mtreemay be a label of a file containing the specification lines.
Parameters
name of resulting
tar_rule“auto”, or an array of specification lines, or a label of a file that contains the lines.
Subject to $(location)
and “Make variable” substitution.
a partially-applied
mtree_mutate ruleWhen using “auto” mtree, this controls whether to include runfiles.If mtree is supplied as an array literal of lines, you are already hardcoding list of included files.When mtree is a label, you need to set include_runfiles in mtree_specs.
should mtree attribute be stamped
additional named parameters to pass to
tar_rule
