Skip to content

Conversation

@ranger-ross
Copy link

@ranger-ross ranger-ross commented Jun 8, 2025

This PR adds basic build.build-dir as mentioned in #143

This implementation is not optimal as it relies on the internal structure of the Cargo target-dir and build-dir.
But the current functionality of cargo-cache needs to look into target and build dir.

The output of the command has been updated to take the build-dir into account.

Below are some samples of the new format.


build-dir not specified

cargo build 
cargo cache local
Project "/home/ross/projects/cargo-cache"

Target dir: /home/ross/projects/cargo-cache/target
    Total Size:       820.55 MB
    debug:            820.55 MB

With build-dir point to a local build directory

export CARGO_BUILD_BUILD_DIR=build
cargo +nightly -Zbuild-dir build
cargo +nightly -Zbuild-dir cache local
Project "/home/ross/projects/cargo-cache"

Target dir: /home/ross/projects/cargo-cache/target
    Total Size:       75.17 MB
    debug:            75.17 MB

Build dir: /home/ross/projects/cargo-cache/build
    Total Size:       731.98 MB
    debug:            731.97 MB

This PR is current blocked waiting on cargo_metadata to publish a release that includes oli-obk/cargo_metadata#297

cc: @epage @weihanglo
cc: rust-lang/cargo#14125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant