Skip to content
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

Maintain dependency semver ranges when publishing new versions #11

Open
XAMPPRocky opened this issue Jun 11, 2020 · 7 comments
Open

Maintain dependency semver ranges when publishing new versions #11

XAMPPRocky opened this issue Jun 11, 2020 · 7 comments

Comments

@XAMPPRocky
Copy link

XAMPPRocky commented Jun 11, 2020

Hey, I was using cargo-ws to publish a new release and I noticed a unintuitive behaviour where it doesn't keep the semver range I set when it needs to update a dependency. For example let's say we have two crates foo and foo-macros.

foo-macros's Cargo.toml

name = "foo-macros"
---version = "0.2.0"
+++version = "0.2.1"
#

foo's Cargo.toml

name = "foo"
---version = "0.2.0"
+++version = "0.2.1"
#
[dependencies]
---foo-macros = { version = "=0.2.0", path = "../macros" }
+++foo-macros = { version = "0.2.1", path = "../macros" }

When I update foo-macros to 0.2.1, cargo-ws will also update foo's dependency of foo-macros and set it from =0.2.0 to 0.2.1 so that the crate can be compiled and published. However this now means that the next time I run cargo ws publish and release 0.2.2offoo-macrosthenfoowill not be updated because0.2.2is semver compatible with0.2.1` which isn't what I want. I want to ensure that both crates are always the same version.

@pksunkara
Copy link
Owner

@XAMPPRocky There's an --exact argument just for this usecase.

@XAMPPRocky
Copy link
Author

Right, but my point is that if I have already specified = in my dependency version in my cargo manifest I shouldn’t have to specify --exact, the tool should infer it.

@pksunkara
Copy link
Owner

Unfortunately I decided not to do it that way due to design considerations. I wanted all the behaviour to be a bit explicit.

@XAMPPRocky
Copy link
Author

That's unfortunate, I don't really think this is really explicit however more than unintuitive. It would be explicit it if I was asked to pick a semver requirement when publishing. Currently it just incorrectly assumes I want the default x.y.z.

@pksunkara
Copy link
Owner

I am thinking about this and what do you think should happen when only some of them have = and others dont?

@XAMPPRocky
Copy link
Author

I would expect that the tool handles it on a case by case basis. If someone's workspace has multiple different semver requirements on the same crate that's their problem in my opinion. If they want to switch to using a single one they can use the --exact flag or an equivalent.

@pksunkara
Copy link
Owner

pksunkara commented Jun 11, 2020

Maybe you are looking for a configuration setting to save this behaviour description? I would have to think on this a bit before I make any changes.

Thanks for creating the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants