hchauvin / rules_archiving

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rules_archiving

Build status

rules_archiving is a Bazel rule for building tarballs, with more flexibility than pkg_tar

Example

In your WORKSPACE:

git_repository(
    name = "hchauvin_rules_archiving",
    remote = "https://github.com/hchauvin/rules_archiving.git",
    commit = "{HEAD}",
)

Then in a BUILD file:

load("@hchauvin_rules_archiving//:defs.bzl", "tar_archive")

tar_archive(
    name = "archive",
    srcs_rename = {
        "//:from.txt": "to.txt",
    },
    # ...
)

tar_archive

tar_archive(srcs_rename, srcs, extension, deps_append, deps_prefixed)

Rule to produce a tarball from a set of files and tarballs. It offers some flexibility concerning how the files are laid out. Among other things, it allows the renaming of files, which might be in some cases more suitable than symlinking, and can be used to avoid using multiple layers of pkg_tar to get to the desired layout.

Attributes
srcs_rename

label_keyed_string_dict; optional

Dictionary of single files to strings. They are added to the tarball under the path given by the strings. The labels can be outside the package invoking the rule.

srcs

list of files; optional

The files must be within the package invoking the rule, and the paths in the tarball are relative to the package.

extension

String; default ".tar"

Extension of the resulting tarball. Can also be ".tar.gz" or ".tar.bz2", in which case the tarball is compressed accordingly.

deps_append

List of tarballs; optional

Tarballs ("*.tar", "*.tar.gz", ...) to append to the output of this rule, with no modification.

deps_prefixed

Dictionary of tarballs to strings; optional

Tarballs ("*.tar", "*.tar.gz", ...) to append to the output of this rule after each of their files is prefixed by the corresponding string in the dictionary.

About

License:Apache License 2.0


Languages

Language:Python 100.0%