bazel-skylib
bazel-skylib copied to clipboard
Search runfiles in `select_file` rule
trafficstars
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.
select_file(
name = "selected",
srcs = ":files",
subpath = "foo/bar.py",
include_runfiles = True,
)
This is an antipattern, because it's flattening a potentially large depset in order to search for a file. Skylib should not support such antipatterns or suggest people use them.
What to do instead? It's hard to suggest alternative without a specific example at hand.