facebook / facebook/buck2

How to forward inputs when transitioning a target?

Open
#834 0 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Rust
Stars
4.4k
Forks
394
PR merge metrics
No merged PRs in 30d

Description

Say I work around https://github.com/facebook/buck2/issues/832 by writing a rule like:

```python
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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.