Skip to content

alias targets should expose FilesToRunProvider if actual has oneΒ #17749

@illicitonion

Description

@illicitonion

Description of the bug:

I have code which runs a cquery to gets the executable of a FilesToRunProvider:

bazel cquery --output=starlark --starlark:expr="providers(target).get(\"FilesToRunProvider\").executable.path"

This doesn't work for alias targets which point to binary targets. It probably should.

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

BUILD file:

py_binary(
    name = "bin",
    srcs = ["bin.py"],
)

alias(
    name = "alias",
    actual = ":bin",
)

Run: bazel cquery --output=starlark --starlark:expr="providers(target).get(\"FilesToRunProvider\").executable.path" :alias

expect to get an output path. Instead, get an error because providers(target).get("FilesToRunProvider") is None.

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

release 6.1.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2We'll consider working on this in future. (Assignee optional)team-Configurabilityplatforms, toolchains, cquery, select(), config transitionstype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions