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

Optionally have set-version update Cargo.lock #698

Open
mmun opened this issue May 4, 2022 · 3 comments
Open

Optionally have set-version update Cargo.lock #698

mmun opened this issue May 4, 2022 · 3 comments

Comments

@mmun
Copy link

mmun commented May 4, 2022

It would be useful in CI / automated publishing scenarios to have cargo set-version ... optionally (e.g. with a flag) able to bump the version in Cargo.lock.

Currently we're relying on subsequent commands (e.g. cargo check) in our workflow to bump the version in Cargo.lock, but this means that we can't run these commands with --locked.

@epage
Copy link
Collaborator

epage commented May 4, 2022

Yes,. for all of cargo-edit this is something I've thought of from time to time. The big issue in cargo-edit is the testing. The test infrastructure within cargo is much better and able to handle it, we just haven't implemented it yet for cargo add.

A big question I've had is how all of this should interact with the global. args --frozen and --locked

@mmun
Copy link
Author

mmun commented May 4, 2022

Yeah, that makes sense.

I think that in the scenario where you're only interested in changing the crate's own version it would be beneficial to treat all the other crate dependencies as locked.

Specifically, I'm thinking about this scenario:

  • You have a Cargo.lock that has stale crate dependencies (i.e. it would be modified if you ran cargo build)
  • You try to bump the version with the hypothetical new command cargo set-version 2.0.0 --update-lockfile

This scenario should either fail or just update the version in both Cargo.toml/Cargo.lock, but it shouldn't also attempt to bump the stale crate dependencies versions in the Cargo.lock.

On the other hand, with cargo add/rm it seems like it would make sense to use the full procedure Cargo uses to update a Cargo.lock.

tl;dr: I think there is some value in differentiating how Cargo.lock is updated between cargo set-version and cargo add/rm.

@sfackler
Copy link

It would also be nice to have this option in cargo upgrade.

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

No branches or pull requests

3 participants