Transitive sets don't aggregate across cells
- Dominant language
- Rust
- Stars
- 4.4k
- Forks
- 394
- PR merge metrics
- No merged PRs in 30d
Description
This seems like a bug, because you can do this with any of the rules in the prelude. My instinct is that the hackery to get stuff in the prelude somehow gets around this problem.
Repro: https://github.com/cormacrelf/buck2-tset-bug
- `library` and `binary` rules in cell `one//`, doing pretty much what the cxx rules in prelude do
- Define some libraries in one cell
- Define a binary in another cell
- ???
- Breaks
```starlark
# root BUCK file
load("@one//:rules.bzl", "binary", "library")
library(name = "a")
library(name = "b", deps = [":a"])
binary(name = "works", deps = [":a", ":b"])
# these fail though
binary(name = "fails", deps = ["one//:lib"])
binary(name = "fails2", deps = ["two//:lib"])
```
```sh
buck2 build :works # works
buck2 build :fails # fails
```
Full error:
> Transitive set transitive values must be of the same transitive set type
> (expected: TransitiveSetDefinition(InfoTSet **declared in one//rules.bzl@root)**,
> got: TransitiveSetDefinition(InfoTSet **declared in one//rules.bzl)**)
```
BUILD FAILED
Error running analysis for `root//:fails (prelude//platforms:default#200212f73efcd57d)`
Caused by:
Traceback (most recent call last):
File , in
* one/rules.bzl:38, in __binary
tset = ctx.actions.tset(
error: Transitive set transitive values must be of the same transitive set type (expected: `TransitiveSetDefinition(InfoTSet declared in one//rules.bzl@root)`, got: `TransitiveSetDefinition(InfoTSet declared in one//rules.bzl)`)
--> one/rules.bzl:38:12
|
38 | tset = ctx.actions.tset(
| ____________^
39 | | InfoTSet,
40 | | children = [
41 | | dep[InfoGraph].tset
42 | | for dep in ctx.attrs.deps
43 | | ],
44 | | )
| |_____^
|
```
Contributor guide
Assessment
This issue has not been assessed yet.