cargo-chef icon indicating copy to clipboard operation
cargo-chef copied to clipboard

Minimise `recipe.json` when `cargo chef prepare` is called with a `--bin` flag

Open LukeMathWalker opened this issue 2 years ago • 2 comments

cargo-chef slims down the workspace members to just the specified binary when cargo chef prepare is invoked with a --bin flag. At the moment (see #207) we still keep around ALL other local manifests, in case the binary depends on another one of the local crates via a path dependency. To maximise cache reuse, we could be more sophisticated: only include in the recipe.json file the manifests of the local crates that are in the dependency closure of the specified binary target.

LukeMathWalker avatar Apr 19 '23 07:04 LukeMathWalker

I think this would follow on nicely from https://github.com/LukeMathWalker/cargo-chef/pull/169

An earlier version had a "collect_local_packages" that walked down from the workspace_packages collecting all local manifests https://github.com/LukeMathWalker/cargo-chef/commit/585a0f5e8784e2be0dc0c9da0dfb5d4915f703a4

Realised that wasn't necessary for #169, but it could serve as the basis for this

markdingram avatar Apr 20 '23 21:04 markdingram