mirror of
https://github.com/bazelbuild/bazel-skylib
synced 2024-11-27 05:43:25 +00:00
16bf90d4ae
A common point of confusion I see around `run_binary` is that it's hard coded to only expand `$(location` values which in codebases I work in are otherwise completely eliminated due to it being described as "legacy" > location: A synonym for either execpath or rootpath, depending on the attribute being expanded. This is legacy pre-Starlark behavior and not recommended unless you really know what it does for a particular rule. See [#2475](https://github.com/bazelbuild/bazel/issues/2475#issuecomment-339318016) for details. If `execpath` is used instead as the appropriate alternative, the rule does no do any expansion and fails the action. This change adds support for expanding all available patterns whenever they're provided.
2.3 KiB
Executable file
2.3 KiB
Executable file
run_binary() build rule implementation.
Runs a binary as a build action. This rule does not require Bash (unlike native.genrule()).
run_binary
run_binary(name, srcs, outs, args, env, 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 | |
srcs | Additional inputs of the action. These labels are available for $(execpath) and $(location) expansion in args and env . |
List of labels | optional | [] |
outs | Output files generated by the action. These labels are available for $(execpath) and $(location) expansion in args and env . |
List of labels | required | |
args | Command line arguments of the binary. Subject to $(execpath) and $(location) expansion. |
List of strings | optional | [] |
env | Environment variables of the action. Subject to $(execpath) and $(location) expansion. |
Dictionary: String -> String | optional | {} |
tool | The tool to run in the action. 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 . |
Label | required |