How do I force a full rebuild of all rust code?
# development
h
How do I force a full rebuild of all rust code?
w
nuke
src/rust/engine/target
and
~/.cache/pants/bin/native-engine
h
So I notice that when I install rustup it installs a "stable" toolchain, and then our bootstrapping installs a 1.49 toolchain?
So we don't really need that
stable
one?
1
w
when you install rustup, it asks you if you want to install the “default” toolchain, which is that stable one
you can choose not to, in which case you’d only get what is configured in a particular directory/project
h
Got it. And the resulting
native_engine.so
gets stored in
~/.cache/pants/bin
and our
./pants
script picks that up from there?
w
yea. that is probably legacy code though at this point… the only copy of
native_engine.so
that matters is at
src/python/pants/engine/internals/native_engine.so
h
Hmm but when I nuked that it didn't rebuild and Pants still ran
src/python/pants/engine/internals/native_engine.so
was recreated in no time
so I assume it was copied from that cache
👍 1
w
correct… the legacy code is copying it out of that cache. but the cache doesn’t need to exist, afaik
because
src/rust/engine/target
contains enough for cargo to recreate it easily without the cache, even during branch switches
👍 1
h
rust 1.50 was released recently
so the 1.49 version we pin the pants repo to is now no longer current
h
Hmm, looks like conserving
src/python/pants/engine/internals/native_engine.so
and
src/python/pants/engine/internals/native_engine.so.metadata
is not enough to prevent a rebuild
w
Needs to match the fingerprint of the sources
h
Yes, it should
this is between two jobs in the same "workflow", i.e., at a single PR commit
(in GitHub Actions)
w
Would echo the computed fingerprint to confirm.
h
could any non-checked-in files be in the fingerprint?
Yeah will do, good idea
Does the entire .metadata file have to be identical, or just the
engine_version
field?
OK weird
It shows that despite storing
native_engine.so
and
native_engine.so.metadata
and restoring them correctly, and the fingerprint being identical, we still rebuild
I'll make those scripts verbose and see what's what
It looks directly in
~/.cache/
and rebuilds if it doesn't find the native engine there
So first step is to not do that