Cargo: Should be able to selectively build/clean deps

Created on 13 Sep 2014  路  5Comments  路  Source: rust-lang/cargo

Especially when the deps are in-tree. For example, we should be able to run cargo build script and cargo clean script to only build/clean that dependency.

Most helpful comment

It's unfortunate that there is no cargo clean --no-deps as cargo metadata have --no-deps flag. For now, I'm using this one-liner to clean only the exec and rlib file of my workspace:

cargo clean $(cargo metadata --no-deps --format-version=1 | jq -r '["-p" + " " + .packages[].name] | join(" ")')

All 5 comments

I'd love to have this! This is dependent on #593 though.

I鈥檇 like to add a request for cargo clean-doc or similar, to force rebuilding documentation without rebuilding dependency libraries.

This is now done with cargo {test,build} -p

This is great: cargo clean -p projectnamehere cleans only the exe file, not the deps - so it saved me 1m23s of build time when using clippy like so

It's unfortunate that there is no cargo clean --no-deps as cargo metadata have --no-deps flag. For now, I'm using this one-liner to clean only the exec and rlib file of my workspace:

cargo clean $(cargo metadata --no-deps --format-version=1 | jq -r '["-p" + " " + .packages[].name] | join(" ")')
Was this page helpful?
0 / 5 - 0 ratings