Faster re-builds for octez-rust-deps in Dune
What
Avoids building the Wasmer headers in every build invocation. (This is also a prerequisite for the other change.)
Modifies the build instructions such that one can change the Cargo target directory via OCTEZ_RUST_DEPS_TARGET_DIR when building the unified Rust dependency crate aka octez-rust-deps.
Why
Being able to specify the Cargo target directory allows you to avoid needing to rebuild from scratch by retaining the incremental build artefacts. This can dramatically speed up the build process, especially when needing to rebuild with Dune (e.g. because you're working on something in Ocaml) after some Rust code has changed.
Manually testing the MR
export OCTEZ_RUST_DEPS_TARGET_DIR="$(pwd)/src/rust_deps/target" # this triggers the magic
dune build src/rust_deps # this might take a bit
make clean
dune build src/rust_deps # this should now be quick despite having cleaned
Edited by Ole Krüger