-
Notifications
You must be signed in to change notification settings - Fork 161
Closed
Labels
Description
This is motivated by a discussion at crate-ci/cargo-release#288
Currently, cargo add will
- dep by path: use the path
- dep by name: look up version in crates.io and uses it
For workspaces, users generally want
- always use path dependency
- If crate being modified is publishable and the dependency is non-dev, use the version that is currently in the workspace
I propose we change cargo add to:
- If user specifies
name@ver,name-as-uri,--git, or--ver,--path, process as we do today - If
nameis in workspace (either as path or name),- always use path dependency
- If crate being modified is publishable and the dependency is non-dev, use the version that is currently in the workspace
For the rare times this isn't the desired behavior, it would be relatively trivial for users to adjust. However, knowing the best practice for adding a workspace dep for new users is tricky
- With
cargo-release, we've seen people use[patch]because it was the first way they discovered doing this - It requires hand copying the version over when specifying path
- The version is flat out wrong when just specifying a name
- Its not obvious that
dev-dependencydoesn't need version which is important when there are test cycles
Reactions are currently unavailable