bazelbuild / bazelbuild/bazel-skylib

Search runfiles in `select_file` rule

Open
#466 1 comment 0 reactions 0 assignees View on GitHub
P4 type: feature request
Dominant language
Starlark
Stars
444
Forks
202
PR merge metrics
No merged PRs in 30d

Description

`select_file` rule currently only searches within `DefaultInfo.files`.

I was wondering if we can add an argument to `select_file` to optionally expand the search criteria to include `DefaultInfo.default_runfiles`

It would look something like this.
```starlark
select_file(
name = "selected",
srcs = ":files",
subpath = "foo/bar.py",
include_runfiles = True,
)
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the `select_file` rule and tracing how it searches `DefaultInfo.files`. Determine how an optional `include_runfiles = True` setting should include `DefaultInfo.default_runfiles`, then verify that the example selecting `foo/bar.py` works when the file exists only in runfiles while existing behavior remains unchanged.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.