-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add "runfile_path" to File #14307
Copy link
Copy link
Open
Labels
P2We'll consider working on this in future. (Assignee optional)We'll consider working on this in future. (Assignee optional)team-Rules-APIAPI for writing rules/aspects: providers, runfiles, actions, artifactsAPI for writing rules/aspects: providers, runfiles, actions, artifactstype: feature request
Description
Description of the problem / feature request:
Add runfile_path property to File object.
What underlying problem are you trying to solve with this feature?
Runfiles are identified by path including their workspace.
short_path is the location of the file relative to the current working directory, when the executable is run under Bazel.
However, that doesn't work if the executable is run outside of Bazel. For that, the file must be found in the runfiles manifest, or the runfiles symlink tree. However, neither of these use the same root as the cwd. Namely, the cwd directory is $runfiles/$workspace_name.
So path manipulation is required. And it requires ctx.workspace_name() which isn't available in Args.add_all() map_each.
Ideally, I could simply use runfile_path and get the path to use in runfile lookup/rlocation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2We'll consider working on this in future. (Assignee optional)We'll consider working on this in future. (Assignee optional)team-Rules-APIAPI for writing rules/aspects: providers, runfiles, actions, artifactsAPI for writing rules/aspects: providers, runfiles, actions, artifactstype: feature request