You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In there you'll see two crates with binary targets: hello-world and goodbye-world. The former has a binary with the same name. The latter has 2 bins and importantly, no dependencies.
Here's my experiments with cargo chef prepare --bin with each of the 3 binaries
The difference between the recipes for hello-world and goodbye-world are as expected: the root Cargo.toml generated only includes the respective crates defining those binaries.
However, you'll notice above that for hasta-la-vista (the other binary of the goodbye-world crate), it includes all the crates in the workspace. Seems unnecessary as it has no dependencies on any other crates in the project.
On a general note: would it be possible to enhance prepare --bin in a way that the .skeleton.lock_file in recipe.json only includes the contents necessary to build the --bin in question? For instance, for the goodbye-world bin in the example repo above, that would mean the Cargo.lock contents in recipe.json would just be
# This file is automatically @generated by Cargo.# It is not intended for manual editing.version = 4
[[package]]
name = "goodbye-world"version = "0.0.1"
So, if one made changes to, say, hello-world dependencies only, that would not change the 'recipe' for goodbye-world, so we could keep the dependencies cached for that binary (well, not a great example since that binary doesn't have deps, but imagine it had one). I'd be willing to work on such feature
The text was updated successfully, but these errors were encountered:
Hi, I've been noticing some cache misses when building out containerized bins in a Cargo workspace, so I set up https://github.com/0xangelo/cargo-workspace-template to experiment with.
In there you'll see two crates with binary targets:
hello-world
andgoodbye-world
. The former has a binary with the same name. The latter has 2 bins and importantly, no dependencies.Here's my experiments with
cargo chef prepare --bin
with each of the 3 binariesThe difference between the recipes for
hello-world
andgoodbye-world
are as expected: the rootCargo.toml
generated only includes the respective crates defining those binaries.However, you'll notice above that for
hasta-la-vista
(the other binary of thegoodbye-world
crate), it includes all the crates in the workspace. Seems unnecessary as it has no dependencies on any other crates in the project.On a general note: would it be possible to enhance
prepare --bin
in a way that the.skeleton.lock_file
inrecipe.json
only includes the contents necessary to build the--bin
in question? For instance, for thegoodbye-world
bin in the example repo above, that would mean theCargo.lock
contents inrecipe.json
would just beSo, if one made changes to, say,
hello-world
dependencies only, that would not change the 'recipe' forgoodbye-world
, so we could keep the dependencies cached for that binary (well, not a great example since that binary doesn't have deps, but imagine it had one). I'd be willing to work on such featureThe text was updated successfully, but these errors were encountered: