Hi!
I have a question about how people handle projects with multiple sub-crates, specially their CI workflows.
My setup is like the following:
+ project/
|--- subcrate_1/
+--- src/
+--- Cargo.toml
|--- subcrate_2/
+--- src/
+--- Cargo.toml
|--- src/
+--- main.rs
|--- Cargo.toml
|--- Cargo.lock
The sub-crates contain independent logic that might get reused in some other projects, and the main crate has them as dependencies (they are both added as workspace
members and as dependencies).
Right now, I have a custom script generateTag.sh <TAG_NAME>
which makes sure that there are no unstaged file changes, and via sed
sets the same version to the main Cargo.toml
and the Cargo.toml
of the sub-crates.
However, before actually creating the tag, in order to keep the Cargo.lock
in sync I need to run a cargo build
in order for the Cargo.lock
to update the sub-crates versions. I've tried to run some cargo check
commands, but they always ended up upgrading transitive dependencies too (which has lead to breaking changes in the past).
I feel like there must be a simpler way to do it, but after checking in popular open source projects I see that most of them have a checklist for a manual process (such as RipGrep).
What I'm asking is: Is there a way to update the Cargo.lock
dependencies, but only the local sub-crates without needing to build the project?
Thanks!