Skip to content

Add "runfile_path" to File #14307

@pauldraper

Description

@pauldraper

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2We'll consider working on this in future. (Assignee optional)team-Rules-APIAPI for writing rules/aspects: providers, runfiles, actions, artifactstype: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions