native_binary() wraps a pre-built binary or script in a *_binary rule interface. Rules like genrule can tool-depend on it, and it can be executed with "bazel run". This rule can also augment the binary with runfiles. native_test() is similar, but creates a testable rule instead of a binary rule. Fixes https://github.com/bazelbuild/bazel-skylib/issues/148 RELNOTES[NEW]: The new `native_binary()` and `native_test()` rules let you wrap a pre-built binary in a binary and test rule respectively.
3.3 KiB
Executable file
native_binary
native_binary(name, src, out, data, kwargs)
Wraps a pre-built binary or script with a binary rule.
You can "bazel run" this rule like any other binary rule, and use it as a tool in genrule.tools for example. You can also augment the binary with runfiles.
Parameters
name |
required. |
src |
required.
label; path of the pre-built executable |
out |
required.
output; an output name for the copy of the binary. (Bazel requires that this rule make a copy of 'src'.) |
data |
optional. default is None
list of labels; data dependencies |
kwargs |
optional. |
native_test
native_test(name, src, out, data, kwargs)
Wraps a pre-built binary or script with a test rule.
You can "bazel test" this rule like any other test rule. You can also augment the binary with runfiles.
Parameters
name |
required. |
src |
required.
label; path of the pre-built executable |
out |
required.
output; an output name for the copy of the binary. (Bazel requires that this rule make a copy of 'src'.) |
data |
optional. default is None
list of labels; data dependencies |
kwargs |
optional. |