Skip to main content

RunInfo

Provider that signals a rule is runnable and defines how to execute it.

RunInfo marks a target as executable and specifies how to run it. When a target provides RunInfo, it can be executed with buck2 run <target>. The provider wraps the command-line arguments that define the executable and its parameters.

Usage

To run a target with RunInfo:

buck2 run <target>                    # Run with the args specified in RunInfo
buck2 run <target> -- [extra args] # Pass additional args after '--' to the command

Examples

Basic executable with script:

def _sh_binary_impl(ctx):
script = ctx.actions.write("script.sh", ctx.attrs.script_content, is_executable = True)
return [
DefaultInfo(default_output = script),
RunInfo(args = cmd_args(script)),
]

Executable with arguments and resources:

def _binary_impl(ctx):
exe = ...

return [
DefaultInfo(default_output = exe),
RunInfo(
args = cmd_args(exe),
),
]

RunInfo.args

RunInfo.args: cmd_args

The command to run, stored as CommandLine