This PR aims at avoiding osmosis-test-tube recompilation even when go files are not changed.
Origin of the issue
Within cw-orchestrator, we use osmosis-test-tube to provide this very nice execution environment to our users. However, when using osmosis-test-tube, it gets recompiled every time we run the cargo build command. In some cases a lot of our dependencies are rendered stale because of osmosis-test-tube. The iterating development process is very lengthy due to this issue.
Run cargo test a second time. You see that it gets compiled again with osmosis-test-tube as the first dependency being compiled
Investigations
When using CARGO_LOG=cargo::core::compiler::fingerprint=info cargo test (see this official rust rebuild guide to understand why), we get this line :
0.163529743s INFO cargo::core::compiler::fingerprint: stale: changed "/path/to/project/target/debug/build/osmosis-test-tube-ee82f39bd1b688b4/out/libosmosistesttube.h"
0.163545353s INFO cargo::core::compiler::fingerprint: (vs) "/path/to/project/target/debug/build/osmosis-test-tube-ee82f39bd1b688b4/output"
0.163549743s INFO cargo::core::compiler::fingerprint: FileTime { seconds: 1706181437, nanos: 970357582 } < FileTime { seconds: 1706181476, nanos: 206700553 }
This indicates that the build procedure is not detected correctly by the cargo dependency machine. I think that the build.rs execution actually finishes before the compilation (and creation of the .h file and thus is not detected correctly.
Proposed solution
We propose to introduce an new env variable (OSMOSIS_TUBE_DEV) that can trigger compilation if set.
The compilation will only take place if :
The library file doesn't exist in the env::var("OUT_DIR") folder.
OR
env::var("OSMOSIS_TUBE_DEV") is set to Ok("1")
That way, all users don't have the recompiling issues. If they want to touch the underlying library, they should set this flag to be able to build every time they do a change.
This PR aims at avoiding osmosis-test-tube recompilation even when go files are not changed.
Origin of the issue
Within cw-orchestrator, we use
osmosis-test-tube
to provide this very nice execution environment to our users. However, when using osmosis-test-tube, it gets recompiled every time we run thecargo build
command. In some cases a lot of our dependencies are rendered stale because of osmosis-test-tube. The iterating development process is very lengthy due to this issue.Reproducing the issue
cargo test
cargo test
a second time. You see that it gets compiled again withosmosis-test-tube
as the first dependency being compiledInvestigations
When using
CARGO_LOG=cargo::core::compiler::fingerprint=info cargo test
(see this official rust rebuild guide to understand why), we get this line :This indicates that the build procedure is not detected correctly by the cargo dependency machine. I think that the build.rs execution actually finishes before the compilation (and creation of the
.h
file and thus is not detected correctly.Proposed solution
We propose to introduce an new env variable (
OSMOSIS_TUBE_DEV
) that can trigger compilation if set.The compilation will only take place if :
env::var("OUT_DIR")
folder. ORenv::var("OSMOSIS_TUBE_DEV")
is set toOk("1")
That way, all users don't have the recompiling issues. If they want to touch the underlying library, they should set this flag to be able to build every time they do a change.