diff options
author | László Csomor <laszlocsomor@users.noreply.github.com> | 2019-01-08 09:04:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-08 09:04:53 +0100 |
commit | 8d4f7612b264849b4b0d7961ab5532f6879d9239 (patch) | |
tree | e49160c5a44e656daac23055033175456e8304f7 /README.md | |
parent | 6dd0b9cbd67478e20361933a994ca01fc1758f43 (diff) | |
download | bazel-skylib-8d4f7612b264849b4b0d7961ab5532f6879d9239.tar.gz |
maprule: an improved version of genrule() (#86)
maprule() is an improved version of
native.genrule(), with the following advantages:
- Maprule can process source files in parallel,
creating separate actions for each of them.
- Maprule does not require declaring all output
files. Instead you declare templates for the
output files yielded for each source. Therefore
N source files and M templates yield N*M
outputs.
- Maprule supports both Bash and cmd.exe syntax
for its commands via the specialized rules
bash_maprule and cmd_maprule.
- Maprule's cmd attribute does deliberately not
support $(location) expression nor Make
Variables, in order to avoid issues and
challenges with quoting. (In case of cmd.exe
passing empty arguments is impossible). These
paths can be passed as envvars instead.
- Maprule's add_env attribute does support
$(location) expressions (and some extra
placeholders) and is the idiomatic way to pass
execpaths of labels in "tools" or "srcs" (the
shared sources available for all actions) to the
command.
See https://github.com/bazelbuild/bazel/issues/4319
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -14,6 +14,8 @@ Each of the `.bzl` files in the `lib` directory defines a "module"—a `struct` that contains a set of related functions and/or other symbols that can be loaded as a single unit, for convenience. +Skylib also provides build rules under the `rules` directory. + ## Getting Started ### `WORKSPACE` file @@ -68,6 +70,10 @@ s = shell.quote(p) * [unittest](lib/unittest.bzl) * [versions](lib/versions.bzl) +## List of rules (in rules/) + +* [`cmd_maprule` and `bash_maprule`](lib/maprule.bzl) + ## Writing a new module Steps to add a module to Skylib: |