bazel-lib/docs/run_binary.md

3.1 KiB

Runs a binary as a build action. This rule does not require Bash (unlike native.genrule()).

This fork of bazel-skylib's run_binary adds directory output support and better makevar expansions.

run_binary

run_binary(name, args, env, output_dir, outs, srcs, tool)

Runs a binary as a build action.

This rule does not require Bash (unlike native.genrule).

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
args Command line arguments of the binary.<br/><br/>Subject to<code><a href="https://docs.bazel.build/versions/main/be/make-variables.html#location">$(location)</a></code> expansion. List of strings optional []
env Environment variables of the action.<br/><br/>Subject to <code><a href="https://docs.bazel.build/versions/main/be/make-variables.html#location">$(location)</a></code> expansion. Dictionary: String -> String optional {}
output_dir Set to True if you want the output to be a directory. Exactly one of outs, output_dir may be used. If you output a directory, there can only be one output, which will be a directory named the same as the target. Boolean optional False
outs Output files generated by the action.<br/><br/>These labels are available for <code>$(location)</code> expansion in <code>args</code> and <code>env</code>. List of labels optional
srcs Additional inputs of the action.<br/><br/>These labels are available for <code>$(location)</code> expansion in <code>args</code> and <code>env</code>. List of labels optional []
tool The tool to run in the action.<br/><br/>Must be the label of a *_binary rule, of a rule that generates an executable file, or of a file that can be executed as a subprocess (e.g. an .exe or .bat file on Windows or a binary with executable permission on Linux). This label is available for <code>$(location)</code> expansion in <code>args</code> and <code>env</code>. Label required