How do I use `anon_targets` to create an overlay/shadow graph?
- Dominant language
- Rust
- Stars
- 4.4k
- Forks
- 394
- PR merge metrics
- No merged PRs in 30d
Description
https://buck2.build/docs/rule_authors/anon_targets/ mentions that anon targets can be used to mimic Bazel aspects.
It's unclear to me _how_ to do this though. I've played with anon targets, but a few questions remain:
- How do I programatically create anon targets from regular targets? So far, I've only seen anon targets either created manually, or created automatically from rules that are controlled by the user. But e.g. I don't know how to generate a shadow graph where the main graph consists of e.g. `cxx_binary` and `cxx_library` targets (the rules for which I don't control).
- How do I access the target graph? AFAIK, anon targets don't show up in the output of `buck2 targets`, and they aren't picked up by the change detector. This makes sense when using them for caching actions, but for creating overlays, I would expect to have a way to actually use/build that overlay to do something useful.
Some examples/docs would be great, but I volunteer to writing some, given enough pointers on how to use this.
Contributor guide
Assessment
This issue has not been assessed yet.