-
Notifications
You must be signed in to change notification settings - Fork 470
packages depending on a toolchain-provided compiler can't cache the first time #11583
Copy link
Copy link
Open
Labels
Description
Hi,
The current toolchains implementation cannot be cached the first time.
Suppose that we have a project with a lock dir, the shared cache is enabled (not just for user fules), and we perform the following steps:
rm -rf ~/.cache/dune(dune cache and toolchains cache)dune build("first build")dune clean- `dune build ("second build")
dune clean- `dune build ("second build")
The observed behavior is that:
- in the first build, we have all cache misses so everything gets built including the compiler (that's expected)
- in the second build, the compiler gets rebuilt but uses toolchains so it's fast; but it causes every dependency to be rebuilt (that's the surprising part)
- in the third build, everything gets rebuilt from cache (that's expected but we'd expect this to happen in the second build already)
What's happening under the hood is that the toolchains code modifies the build and install instruction if an installed toolchain is found, causing a change in the rule digest (in turn causing a cache miss).
A comment notes that this could be done at rule execution time. It might be possible to tweak the digest cache too but I'm not sure about that.
(NB: instead of wasting a full build, interrupting the build once the compiler is built might reduce the amount of wasted artifacts)
Reactions are currently unavailable