Skip to main content
Version: 1.5.x

run_binary

run_binary() build rule implementation.

Runs a binary as a build action. This rule does not require Bash (unlike native.genrule()).

Rules

run_binary

Runs a binary as a build action.

This rule does not require Bash (unlike native.genrule).

Example usage (generated):

load("@bazel_skylib//rules:run_binary.bzl", "run_binary")

run_binary(
# A unique name for this target.
name = "",
# Output files generated by the action
outs = [],
# The tool to run in the action
tool = "",
)

name

Required name.

A unique name for this target.

args

Optional list of strings. Default: []

Command line arguments of the binary.

Subject to $(location) expansion.

env

Optional dictionary: String → String. Default: {}

Environment variables of the action.

Subject to $(location) expansion.

outs

Required list of labels.

Output files generated by the action.

These labels are available for $(location) expansion in args and env.

srcs

Optional list of labels. Default: []

Additional inputs of the action.

These labels are available for $(location) expansion in args and env.

tool

Required label.

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 $(location) expansion in args and env.