https://pantsbuild.org/ logo
#development
Title
# development
h

happy-kitchen-89482

02/11/2021, 7:16 PM
How do I force a full rebuild of all rust code?
w

witty-crayon-22786

02/11/2021, 7:20 PM
nuke
src/rust/engine/target
and
~/.cache/pants/bin/native-engine
h

happy-kitchen-89482

02/11/2021, 7:30 PM
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

witty-crayon-22786

02/11/2021, 7:31 PM
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

happy-kitchen-89482

02/11/2021, 7:31 PM
Got it. And the resulting
native_engine.so
gets stored in
~/.cache/pants/bin
and our
./pants
script picks that up from there?
w

witty-crayon-22786

02/11/2021, 7:32 PM
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

happy-kitchen-89482

02/11/2021, 7:33 PM
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

witty-crayon-22786

02/11/2021, 7:34 PM
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

hundreds-breakfast-49010

02/11/2021, 7:57 PM
rust 1.50 was released recently
so the 1.49 version we pin the pants repo to is now no longer current
h

happy-kitchen-89482

02/12/2021, 12:55 AM
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

witty-crayon-22786

02/12/2021, 12:56 AM
Needs to match the fingerprint of the sources
h

happy-kitchen-89482

02/12/2021, 12:57 AM
Yes, it should
this is between two jobs in the same "workflow", i.e., at a single PR commit
(in GitHub Actions)
w

witty-crayon-22786

02/12/2021, 12:58 AM
Would echo the computed fingerprint to confirm.
h

happy-kitchen-89482

02/12/2021, 12:58 AM
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