-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Cargo workspace member dep version ranges #15526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
So if I'm understanding correctly, you want to do:
[workspace]
members = ["crates/*"]
[package]
name = "a"
[dependencies]
b = { version = "1.0", member = true }
[package]
name = "c"
[dependencies]
b = { version = "1.1", member = true }
[package]
name = "b"
version = "1.2.0" Instead of:
[workspace]
members = ["crates/*"]
[package]
name = "a"
[dependencies]
b = { version = "1.0", path = "../b" }
[package]
name = "c"
[dependencies]
version = { version = "1.1.0", path = "../b" }
[package]
name = "b"
version = "1.2.0" Is that correct? |
That is supported through the unstable
This would allow you to reuse the path but reduce have a custom version range, right? |
Yes that's correct. |
Yes, so we could do
I also think in your 2nd example you switched the package version with the dependency version. |
Variants of
Those don't handle the problem of when you want to intentionally have your version requirements diverge. One part of #13453 that has particular relevance for As an alternative to #13453, we proposed #15180 but that still has the problem of centralizing the version requirements. |
To avoid making assumptions, what is your use case for having version requirements diverge? Do you have any strategy to ensure your version requirements are not too low / stale? |
In our workspace if we make a change to a member because we need it in another member we then bump that version in place. We also have a publish time check to detect if any version is too low since we build with the version minimums. The reason we need this is because it is very hard to detect programmatically if we depend on the newer version or if it was just a consequence of it being apart of the same workspace that the dependency version changed. However obviously with semver breaking changes and we bump a major version we would need to fix that everywhere that is expected. However we could add a range to catch both ranges if we support both. |
Could you provide more details on this check? |
It's a wrapper around |
Ah, I was not aware that had |
Yes that is correct. |
Problem
In cargo workspace
crates
{a, b, c}
a requires: b >= 1.0
c requires: b >= 1.1
b is at 1.2.0
how can I specify these versioning conditions when publishing to crates io without resorting to using
path = "../../b"
or some other combination of path based providing.Currently workspace deps override the
version
config value.Proposed Solution
Have a new config
member = true
which allows you to reference workspace members directly without using a workspace dep and then allow that member to have version ranges and if not provided use the current version of the member.I don't like the idea of paths because it makes it increasingly messy. I think its silly we need to declare workspace members as part the workspace-deps list.
Alternatives
Allow for a new template in the path syntax to resolve to the root of the workspace
b = { path = "{root}/crates/b" }
Lift the restriction of workspace version inheritance and instead allow workspace deps to override the version.
Notes
No response
The text was updated successfully, but these errors were encountered: