Skip to content

How to forward inputs when transitioning a target? #834

Open
@cbarrete

Description

Say I work around #832 by writing a rule like:

my_transitioned_target = rule(
    impl = lambda ctx: ctx.attrs.base.providers,
    attrs = {
        # `my_transition` just adds `my_constraint` to the configuration.
        "base": attrs.transition_dep(cfg = my_transition),
        "my_constraint": attrs.label(),
    },
)

If I add a target using this rule and query its inputs (using either the CLI or BXL), I get an empty list. This kind of makes sense to me, but from an end-user perspective, I'd like my transitioned target to mostly behave like the base one, including carrying the same inputs. Is there a way that I can achieve that?

I've tried working around that by adding an arg attr that I populate with a $(query_outputs inputs(:my_base_target)) string parameter macro, but then I run into configuration incompatibility issues because the base and transitioned targets are incompatible.

Any help would be greatly appreciated!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions