`.bzl` file changes do not trigger builds/tests
cbarrete opened this issue · 2 comments
I've played around with buck2-change-detector
and we're considering using it, but there's an edge case that I cannot get covered: modifications to .bzl
files do not cause rebuilds of targets that include them.
This is quite surprising to me, as rerun_starlark
in btd/src/rerun.rs
seems like it should be handling that just fine.
Here is a simplified version of what I'm working with, where repo
is my repo and buck2
is the directory under which we have the prelude, our toolchains, custom rules, etc:
cells.json
{
"prelude": "/path/to/repo/buck2/prelude",
"toolchains": "/path/to/repo/buck2/toolchains",
"none": "/path/to/repo/none",
"root": "/path/to/repo"
}
changes.txt
M buck2/rules/test.bzl
base.jsonl
excerpt
...
{"buck.package":"root//some/target","buck.file":"root//some/target/BUCK","buck.imports":["prelude//prelude.bzl","root//buck2/rules/test.bzl"]}
{"buck.package":"root//other/target","buck.file":"root//other/target/BUCK","buck.imports":["prelude//prelude.bzl","root//buck2/rules/test.bzl"]}
{"buck.file":"root//buck2/rules/test.bzl","buck.imports":["prelude//prelude.bzl","prelude//paths.bzl"]}
...
diff.jsonl
has the same contents in another order.
test.bzl
defines a function that looks something like this:
load("@prelude//:paths.bzl", "paths")
def my_test(name, deps = [], **kwargs):
# Custom things...
native.cxx_test(
name = name,
deps = deps,
**kwargs
)
We use this function in many places to define test targets (by way of load("//buck2/rules/test.bzl", "my_test")
), so I expect a change in this file to trigger many builds/tests, but:
> supertd btd --cells cells.json --changes changes.txt --base base.jsonl --diff diff.jsonl
2024-02-27T21:53:31.074644Z INFO Starting reading cells at 0.000s
2024-02-27T21:53:31.074679Z INFO Starting reading changes at 0.000s
2024-02-27T21:53:31.074692Z INFO Starting reading base at 0.000s
2024-02-27T21:53:31.094598Z INFO Starting validating universe at 0.020s
2024-02-27T21:53:31.094620Z INFO Starting reading diff at 0.020s
2024-02-27T21:53:31.101620Z INFO Starting immediate changes at 0.027s
2024-02-27T21:53:31.103091Z INFO Starting error validation at 0.028s
2024-02-27T21:53:31.103140Z INFO Starting recursive changes at 0.028s
2024-02-27T21:53:31.103149Z INFO Starting printing changes at 0.029s
Level 0
2024-02-27T21:53:31.103162Z INFO Starting finish with 0 immediate changes, 0 total changes at 0.029s
Nothing! No targets are listed as being impacted, when the inputs to btd
show that this file was modified. Am I missing something here? This is all using the latest released buck2/prelude and btd and friends built from master.
@cbarrete BTD will only rerun the target if some of its (unconfigured) attributes actually change. Is that the case here? If not, then everything is working as expected I think
Apparently not, my changes were not significant enough (e.g. adding whitespace or print statements). This is better than expected!