This is liable to change in the future.A
zip_file()allows builds to create basic zip files in a platform-agnostic way.
The short name for this build target.
The name of the zip file that should be generated. This allows builds to use a meaningful target name coupled with a meaningful zip file name. The default value takes the rule's
The set of files to include in the zip.
srcwill be added to the zip as follows:
- If the
srcis the output of another rule, the output will be included using just the output's file name.
- If the
srcis a file relative to the rule's declaration, it will be included in the zip with its relative file name.
- If the
The set of zip files whose content to include in the output zip file.
Note that the order of files in
zip_srcsmatters because the same zip entry can be included from multiple files. See the
on_duplicate_entryargument to learn how to control the behavior when there are multiple entries with the same name. The entries from
zip_srcsare added before files from
List of regex expressions that describe entries that should not be included in the output zip file.
The regexes must be defined using
Action performed when Buck detects that zip_file input contains multiple entries with the same name.
The valid values are:
overwrite(default): the last entry overwrites all previous entries with the same name.
append: all entries are added to the output file.
fail: fail the build when duplicate entries are present.
List of build target patterns that identify the build rules that can include this rule as a dependency, for example, by listing it in their
exported_depsattributes. For more information, see visibility.
This example will create a simple zip file.
zip_file( # The output will be "example.zip" name = 'example', srcs = # These files will be found in the zip under "dir/" glob(['dir/**/*']) + [ # Imagine this generates the output # "buck-out/gen/foo/hello.txt". This output will # be found in the zip at "hello.txt" '//some/other:target', ], zip_srcs = [ # The contents of this zip will be added to the generated zip. 'amazing-library-1.0-sources.zip', ], entries_to_exclude = [ "com/example/amazinglibrary/Source1.java", ], )If you were to examine the generated zip, the contents would look something like (assuming the output of "
//some/other:target" was a file who's path ended with
hello.txt, the "
dir" glob found two files, and "
amazing-library-1.0-sources.zip" contained two Java source files):
dir/file1.txt dir/subdir/file2.txt hello.txt com/example/amazinglibrary/Source2.java