2
0
Fork 0
mirror of https://github.com/bazelbuild/bazel-skylib synced 2024-11-30 10:41:18 +00:00
bazel-skylib/docs/native_binary_doc.md
László Csomor c585222071
New rules: native_binary and native_test (#152)
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.
2019-05-14 13:33:01 +02:00

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.

The common attributes for binaries.

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.

The common attributes for tests.