Refine Cargo / C++ build integration #2080
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
RUST_TARGET
to setCARGO_BUILD_TARGET
which is tracked by cargo (https://doc.rust-lang.org/cargo/reference/environment-variables.html)CARGO_TARGET_DIR
env instead of having to pass--target-dir
in each step.--all-targets
when not cross compiling to catch more failures earlyJOBS
var to setCARGO_BUILD_JOBS
to maintain coherency across jobs.cargo/config.toml
apply..cargo/config.toml
to the root dir so that it works across all tooling since cargo searches up.make.sh
MAKE_JOBS
is now respected throughout the build and carried coherently across C++ and Rust../make.sh lib
is now available that forwards to the Makefile in/lib
for easier execution../make.sh lib check / lib fmt / lib fmt-check
etc are now used through this.compiledb
now available with./make.sh
for conveniencerust-analyzer-check
for better consistency across build configs_get_default_jobs
is now used by default during make to ensure that there's a max cap of80%
of the cores on compiles to now use up all cores. 20% offers minimal difference to compile times, but provides for better dev experience without overloading machines.Misc
.vscode/settings.default.json
for recommended coherent settings that avoiding excessive recompilation during devFurther pending Rust Issues
Rust-analyzer and cargo build ends up in different configs due to RUSTFLAGS. What's applied in.cargo/config.toml
doesn't seem to be applied to rust-analyzer workflow resulting in multiple compilations and invalidating compile caches all the time.Not sure why, since the target dir is picked up as expected, just RUSTFLAGS aren't applied. Can be verified by looking into the fingerprints json files.Related (May be): rust-analyzer.toml rust-lang/rust-analyzer#13529Implications
Storage
Consensus