Replies: 1 comment
|
Confirmed: the shim passes Opened #455 to wrap The regression test runs build → install → build and checks that the build script runs only once, including installs launched outside the package directory. The full Until the fix is released, running this from the package directory is another workaround that retains Cargo's installation behavior: mbx install --locked --path . --target-dir target |
Uh oh!
There was an error while loading. Please reload this page.
Summary
The cargo shim passes
cargo installthrough to real cargo without the mbx environment (RUSTC_WRAPPER,HOST_CC,CC, ...), but wrapscargo build. When both commands share a target directory, they invalidate each other's fingerprints, and every C-dependency crate rebuilds on each switch.What I observed
mbx 1.10.1 on Linux (WSL2). A project script ran:
Each command rebuilt about 30 crates that the other had just built.
CARGO_LOG=cargo::core::compiler::fingerprint=info cargo build --release ...after thecargo installreported:for
ring,aws-lc-sys,zstd-sys,libsqlite3-sys,tree-sitter, and thenUnitDependencyInfoChangedfor everything above them. Thecccrate declaresrerun-if-env-changedforHOST_CC/CC, so the build-script fingerprints differ between the wrapped and passthrough invocations.Cause
cargo_proxy_passthroughincrates/mbx/src/cli/shim.rslistsinstallamong the subcommands that skip the shim.cargo installcompiles code, and it accepts--target-dir(orCARGO_TARGET_DIR), so it can share a target directory with wrapped builds.Suggestion
Treat
cargo installas a build command, at least when it builds from a path (--path) or when--target-dir/CARGO_TARGET_DIRis set. That gives it the same cache benefits and keeps its fingerprints consistent withcargo build.If there is a reason
installmust stay passthrough, documenting it in the README would help. I changed my script to usecargo buildplus a copy instead, which fixed the rebuild loop.All reactions