bazelbuild / bazelbuild/bazel

actions.run - "tools" argument has wrong documentation

Open
#13,854 3 comments 0 reactions 0 assignees View on GitHub
not stale P3 team-Documentation team-Rules-API type: documentation (cleanup)
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the problem / feature request:

The "tools" argument from[ actions.run](https://docs.bazel.build/versions/main/skylark/lib/actions.html#run) has wrong documentation:

* It says it expects a sequence or depset. However Bazel complains:
"expected value of type 'File or FilesToRunProvider' for a member of parameter 'tools' "

* It says "Tools are inputs with additional runfiles". This is not possible if "tools" must be a "File", because "File" is just one file, it doesn't have "runfiles".

### Feature requests: what underlying problem are you trying to solve with this feature?

I'm trying to pass a "filegroup" target as a "tool" for an action. I cannot because it wants me to pass a File instead. If I pass a File, I cannot "automatically pass" the runfiles (data) of my filegroup.

### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
1) Create a filegroup

filegroup(
name = "foo",
srcs = ["foo"],
data = [
"bar",
],
)

2) Pass that filegroup as "tools" for the action

ctx.actions.run(
tools = ctx.attr.foo,
)

3) Bazel will complain that it wants a File there, against the documentation.

### What operating system are you running Bazel on?

Ubuntu 18.04

### What's the output of `bazel info release`?

release 4.1.0

### If `bazel info release` returns "development version" or "(@non-git)", tell us how you built Bazel.

N/A

Contributor guide

Open the contributing guide

Research direction

Start with the actions.run documentation at the linked actions.html#run page and compare the tools argument description with the reported error from Bazel 4.1.0. Reproduce the behavior using the provided filegroup and ctx.actions.run example; done means the documentation accurately describes the accepted value and runfiles behavior.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.