xref: /aosp_15_r20/external/bazel-skylib/docs/run_binary_doc.md (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1*bcb5dc79SHONG Yifan<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2*bcb5dc79SHONG Yifan
3*bcb5dc79SHONG Yifanrun_binary() build rule implementation.
4*bcb5dc79SHONG Yifan
5*bcb5dc79SHONG YifanRuns a binary as a build action. This rule does not require Bash (unlike native.genrule()).
6*bcb5dc79SHONG Yifan
7*bcb5dc79SHONG Yifan<a id="run_binary"></a>
8*bcb5dc79SHONG Yifan
9*bcb5dc79SHONG Yifan## run_binary
10*bcb5dc79SHONG Yifan
11*bcb5dc79SHONG Yifan<pre>
12*bcb5dc79SHONG Yifanrun_binary(<a href="#run_binary-name">name</a>, <a href="#run_binary-srcs">srcs</a>, <a href="#run_binary-outs">outs</a>, <a href="#run_binary-args">args</a>, <a href="#run_binary-env">env</a>, <a href="#run_binary-tool">tool</a>)
13*bcb5dc79SHONG Yifan</pre>
14*bcb5dc79SHONG Yifan
15*bcb5dc79SHONG YifanRuns a binary as a build action.
16*bcb5dc79SHONG Yifan
17*bcb5dc79SHONG YifanThis rule does not require Bash (unlike `native.genrule`).
18*bcb5dc79SHONG Yifan
19*bcb5dc79SHONG Yifan**ATTRIBUTES**
20*bcb5dc79SHONG Yifan
21*bcb5dc79SHONG Yifan
22*bcb5dc79SHONG Yifan| Name  | Description | Type | Mandatory | Default |
23*bcb5dc79SHONG Yifan| :------------- | :------------- | :------------- | :------------- | :------------- |
24*bcb5dc79SHONG Yifan| <a id="run_binary-name"></a>name |  A unique name for this target.   | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required |  |
25*bcb5dc79SHONG Yifan| <a id="run_binary-srcs"></a>srcs |  Additional inputs of the action.<br><br>These labels are available for `$(execpath)` and `$(location)` expansion in `args` and `env`.   | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional |  `[]`  |
26*bcb5dc79SHONG Yifan| <a id="run_binary-outs"></a>outs |  Output files generated by the action.<br><br>These labels are available for `$(execpath)` and `$(location)` expansion in `args` and `env`.   | List of labels | required |  |
27*bcb5dc79SHONG Yifan| <a id="run_binary-args"></a>args |  Command line arguments of the binary.<br><br>Subject to [`$(execpath)` and `$(location)`](https://bazel.build/reference/be/make-variables#predefined_label_variables) expansion.   | List of strings | optional |  `[]`  |
28*bcb5dc79SHONG Yifan| <a id="run_binary-env"></a>env |  Environment variables of the action.<br><br>Subject to  [`$(execpath)` and `$(location)`](https://bazel.build/reference/be/make-variables#predefined_label_variables) expansion.   | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional |  `{}`  |
29*bcb5dc79SHONG Yifan| <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 `$(execpath)` and `$(location)` expansion in `args` and `env`.   | <a href="https://bazel.build/concepts/labels">Label</a> | required |  |
30*bcb5dc79SHONG Yifan
31*bcb5dc79SHONG Yifan
32