Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search runfiles in select_file rule #466

Open
kpark-hrp opened this issue Oct 9, 2023 · 1 comment
Open

Search runfiles in select_file rule #466

kpark-hrp opened this issue Oct 9, 2023 · 1 comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) type: feature request

Comments

@kpark-hrp
Copy link

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,
)
@comius comius added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) type: feature request labels Oct 13, 2023
@comius
Copy link
Collaborator

comius commented Oct 31, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) type: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants