2
0
Fork 0
mirror of https://github.com/bazelbuild/bazel-skylib synced 2024-11-27 05:43:25 +00:00
bazel-skylib/docs/native_binary_doc.md
2022-01-12 11:28:43 -05:00

2.7 KiB
Executable file

native_binary() and native_test() rule implementations.

These rules let you wrap a pre-built binary or script in a conventional binary and test rule respectively. They fulfill the same goal as sh_binary and sh_test do, but they run the wrapped binary directly, instead of through Bash, so they don't depend on Bash and work with --shell_exectuable="".

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 Description Default Value
name The name of the rule. none
src label; path of the pre-built executable none
out output; an output name for the copy of the binary. (Bazel requires that this rule make a copy of 'src'.) none
data list of labels; data dependencies None
kwargs The <a href="https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes-binaries">common attributes for binaries</a>. none

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 Description Default Value
name The name of the test rule. none
src label; path of the pre-built executable none
out output; an output name for the copy of the binary. (Bazel requires that this rule make a copy of 'src'.) none
data list of labels; data dependencies None
kwargs The <a href="https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes-tests">common attributes for tests</a>. none