A better tool to manage complex cargo workspaces. Dynamically builds a dependency graph of your workspace and lets you execute commands and queries on it. This project is both a CLI and a library.
Currently only supports only two commands, which are publish
and
print
. cargo-ws2
can manage publishing crates for you, which is
especially useful when a lot of crates in your workspace depend on it
with both a path, and version bound. Let's look at an example.
```toml [package] name = "foo" version = "0.1.0"
[dependencies] bar = { version = "0.5.0", path = "../bar" } ```
toml
[package]
name = "bar"
version = "0.5.0"
This is a common setup: pointing cargo at the path
of bar
means
that changes to the sources on disk become available, before having to
publish to crates.io. But having a version dependency is required
when trying to publish to crates.io, thus we add this too.
Unfortunately now, when we update bar
to version 0.6.0
our
workspace will stop building, because foo
depends on a version of
bar
that's different from the one we're pointing it to. (I'm sure
that this could be fixed in cargo? maybe...).
What cargo-ws2
does when you run cargo ws2 [bar] publish minor
is
bump bar to 0.6.0
, and also update the dependency line in foo
to
be { version = "0.6.0", path = "../bar" }
, without touching the
version of foo
.
cargo-ws2
is an expression language, where you first provide a set
of crates, based on a query to the workspace graph, then it executes a
single command for all selected crates. Following are some examples.
[ ]
: cargo ws2 [foo bar baz] publish patch
cargo ws2 [./foo/*] publish major rc
cargo ws2 [/crate-suffix\$/] publish minor alpha
cargo ws2 { foo < } show
(print all
crates that depend on foo
)See the full description of ws2ql
in the docs!
cargo-workspace2
is free software, licensed under the GNU General
Public License 3.0 (or later). See the LICENSE file for a full copy
of the license.