| <!-- Generated with Stardoc: http://skydoc.bazel.build --> |
| |
| Runs a js_binary as a build action. |
| |
| This macro wraps Aspect bazel-lib's run_binary (https://github.com/aspect-build/bazel-lib/blob/main/lib/run_binary.bzl) |
| and adds attributes and features specific to rules_js's js_binary. |
| |
| Load this with, |
| |
| ```starlark |
| load("@aspect_rules_js//js:defs.bzl", "js_run_binary") |
| ``` |
| |
| |
| <a id="#js_run_binary"></a> |
| |
| ## js_run_binary |
| |
| <pre> |
| js_run_binary(<a href="#js_run_binary-name">name</a>, <a href="#js_run_binary-tool">tool</a>, <a href="#js_run_binary-env">env</a>, <a href="#js_run_binary-srcs">srcs</a>, <a href="#js_run_binary-output_dir">output_dir</a>, <a href="#js_run_binary-outs">outs</a>, <a href="#js_run_binary-args">args</a>, <a href="#js_run_binary-chdir">chdir</a>, <a href="#js_run_binary-stdout">stdout</a>, <a href="#js_run_binary-stderr">stderr</a>, <a href="#js_run_binary-exit_code_out">exit_code_out</a>, |
| <a href="#js_run_binary-silent_on_success">silent_on_success</a>, <a href="#js_run_binary-copy_srcs_to_bin">copy_srcs_to_bin</a>, <a href="#js_run_binary-log_level">log_level</a>, <a href="#js_run_binary-kwargs">kwargs</a>) |
| </pre> |
| |
| Wrapper around @aspect_bazel_lib run_binary that adds convienence attributes for using a js_binary tool. |
| |
| This rule does not require Bash `native.genrule`. |
| |
| |
| **PARAMETERS** |
| |
| |
| | Name | Description | Default Value | |
| | :------------- | :------------- | :------------- | |
| | <a id="js_run_binary-name"></a>name | Target name | none | |
| | <a id="js_run_binary-tool"></a>tool | The tool to run in the action.<br><br>Should be a js_binary rule. Use Aspect bazel-lib's run_binary (https://github.com/aspect-build/bazel-lib/blob/main/lib/run_binary.bzl) for other *_binary rule types. | none | |
| | <a id="js_run_binary-env"></a>env | Environment variables of the action.<br><br>Subject to <code>$(location)</code> and make variable expansion. | <code>{}</code> | |
| | <a id="js_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="js_run_binary-output_dir"></a>output_dir | Set to True if you want the output to be a directory.<br><br>Exactly one of <code>outs</code>, <code>output_dir</code> 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. | <code>False</code> | |
| | <a id="js_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>. | <code>[]</code> | |
| | <a id="js_run_binary-args"></a>args | Command line arguments of the binary.<br><br>Subject to <code>$(location)</code> and make variable expansion. | <code>[]</code> | |
| | <a id="js_run_binary-chdir"></a>chdir | Working directory to run the binary or test in, relative to the workspace.<br><br>This overrides the chdir value if set on the js_binary tool target.<br><br>By default, Bazel always runs in the workspace root.<br><br>To run in the directory containing the js_run_binary under the source tree, use <code>chdir = package_name()</code> (or if you're in a macro, use <code>native.package_name()</code>).<br><br>To run in the output directory where the js_run_binary writes outputs, use <code>chdir = "$(RULEDIR)"</code><br><br>WARNING: this will affect other paths passed to the program, either as arguments or in configuration files, which are workspace-relative.<br><br>You may need <code>../../</code> segments to re-relativize such paths to the new working directory. | <code>None</code> | |
| | <a id="js_run_binary-stdout"></a>stdout | set to capture the stdout of the binary to a file, which can later be used as an input to another target subject to the same semantics as <code>outs</code> | <code>None</code> | |
| | <a id="js_run_binary-stderr"></a>stderr | set to capture the stderr of the binary to a file, which can later be used as an input to another target subject to the same semantics as <code>outs</code> | <code>None</code> | |
| | <a id="js_run_binary-exit_code_out"></a>exit_code_out | set to capture the exit code of the binary to a file, which can later be used as an input to another target subject to the same semantics as <code>outs</code>. Note that setting this will force the binary to exit 0.<br><br>If the binary creates outputs and these are declared, they must still be created | <code>None</code> | |
| | <a id="js_run_binary-silent_on_success"></a>silent_on_success | produce no output on stdout nor stderr when program exits with status code 0.<br><br>This makes node binaries match the expected bazel paradigm. | <code>True</code> | |
| | <a id="js_run_binary-copy_srcs_to_bin"></a>copy_srcs_to_bin | When True, all srcs files are copied to the output tree that are not already there. | <code>True</code> | |
| | <a id="js_run_binary-log_level"></a>log_level | Set the logging level of the js_binary tool.<br><br>This overrides the log level set on the js_binary tool target. | <code>None</code> | |
| | <a id="js_run_binary-kwargs"></a>kwargs | Additional arguments | none | |
| |
| |