bazelbuild / bazelbuild/bazel-skylib

Allow run_binary to have executable's execute tools

Open
#594 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
444
Forks
202
PR merge metrics
No merged PRs in 30d

Description

Currently if a binary `foo` internally executes binary `bar`, then `bar`'s runfiles tree may not be populated as `bar` can only be added as an `input` and not as part of the `tools`.
```
ctx.actions.run(
outputs = ctx.outputs.outs,
inputs = ctx.files.srcs,
tools = [ctx.executable.tool],
executable = ctx.executable.tool,
arguments = args,
mnemonic = "RunBinary",
use_default_shell_env = False,
env = dicts.add(ctx.configuration.default_shell_env, envs),
)
```
https://github.com/bazelbuild/bazel-skylib/blob/471f368fc95a7323078f69d569a164ee5bc07f8b/rules/run_binary.bzl#L44C1-L53C6

Instead to ensure it is, it could be better to have:

```
tools = ctx.executable.tools,
executable = ctx.executable.executable,
```

This would require a minor change in the attributes in that `tool` now becomes a list.

Contributor guide

Open the contributing guide

Research direction

Start with rules/run_binary.bzl at the linked run_binary implementation, then inspect the rule attributes and existing callers. Done means run_binary can expose executable tools so an internally executed binary receives its runfiles without breaking the current interface.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.