pksunkara/cargo-workspaces

Help manage development workflow

Closed this issue · 2 comments

I've written this as a request for an enhancement, but you can also consider it a question: "Does it work this way already?"
(I'm not sure until I overcome some issues I have with publishing....as you cannot publish with a local dependency right?).
If it does work this way, then maybe we can add it (I'd be happy to PR the readme) to the explanation of the "publish" command?

In my workspace project I have a number of crates still in active development with dependencies between them.
While developing I would like to have them depend on the local versions that are being actively changed via path dependencies:

[dependencies]
flow_impl = {path = "../flow_impl" }
flowstdlib = {path = "../flowstdlib"}
provider = {path = "../provider"}

When versioning and publishing the ideal for me would be:

  • modify the version numbers in Cargo.toml (as version command does now)
  • when publishing according to the dependency tree, switch the crate being built to have dependencies on the recently published versions (not local paths), build and publish it
  • when all published maybe either switch back to local paths, or provide a command to switch them back to local paths? (I could live without this, and then just have to edit manually if a crate starts to change...)

Maybe you could help add some documentation, but the recommended way of development is having the Cargo.toml like this:

[dependencies]
flow_impl = {path = "../flow_impl", version = "1.3" }
flowstdlib = {path = "../flowstdlib", version = "0.2.0" }
provider = {path = "../provider", version = "=0.1.0" }

This works 2 ways. When you are running locally, it uses path. When you publish it, it uses version. This way, you don't need to keep constantly changing it.

When the tool modifies the version numbers for publishing, it modifies them in the dependencies here too. And since it publishes in the correct order, you will not have any issue with the required dependency version not being published before.

You can see a good example here