bazel-lib/docs/run_binary.md

37 lines
2.9 KiB
Markdown
Raw Normal View History

<!-- Generated with Stardoc: http://skydoc.bazel.build -->
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.
2022-06-10 20:05:19 +00:00
<a id="run_binary"></a>
## run_binary
<pre>
run_binary(<a href="#run_binary-name">name</a>, <a href="#run_binary-tool">tool</a>, <a href="#run_binary-srcs">srcs</a>, <a href="#run_binary-args">args</a>, <a href="#run_binary-env">env</a>, <a href="#run_binary-outs">outs</a>, <a href="#run_binary-out_dirs">out_dirs</a>, <a href="#run_binary-output_dir">output_dir</a>, <a href="#run_binary-kwargs">kwargs</a>)
</pre>
Runs a binary as a build action.
This rule does not require Bash (unlike `native.genrule`).
**PARAMETERS**
| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="run_binary-name"></a>name | The target name | none |
| <a id="run_binary-tool"></a>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>. | none |
| <a id="run_binary-srcs"></a>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>. | <code>[]</code> |
| <a id="run_binary-args"></a>args | Command line arguments of the binary.<br><br>Subject to <code>$(location)</code> and makevar expansions. | <code>[]</code> |
| <a id="run_binary-env"></a>env | Environment variables of the action.<br><br>Subject to <code>$(location)</code> and makevar expansions. | <code>{}</code> |
| <a id="run_binary-outs"></a>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>.<br><br>Output files cannot be nested within output directories in out_dirs. | <code>[]</code> |
| <a id="run_binary-out_dirs"></a>out_dirs | Output directories generated by the action.<br><br>These labels are _not_ available for <code>$(location)</code> expansion in <code>args</code> and <code>env</code> sincew they are not pre-declared labels created via attr.output_list(). Output directories are declared instead by <code>ctx.actions.declare_directory</code>.<br><br>Output directories cannot be nested within other output directories in out_dirs. | <code>[]</code> |
| <a id="run_binary-output_dir"></a>output_dir | If set to True then an output directory named the same as the target name is added to out_dirs.<br><br>Deprecated. For backward compatability with @aspect_bazel_lib 1.x. Use out_dirs instead. | <code>False</code> |
| <a id="run_binary-kwargs"></a>kwargs | Additional arguments | none |