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

Cargo.lock must be updated too for version #1201

Open
lfdominguez opened this issue Aug 8, 2024 · 4 comments
Open

Cargo.lock must be updated too for version #1201

lfdominguez opened this issue Aug 8, 2024 · 4 comments

Comments

@lfdominguez
Copy link

Description

In rust when you change the version of the app, the Cargo.lock file must be changed too.

Possible Solution

Using the same toml parser, must change the package->name = <same that Cargo.toml>->version

Additional context

No response

Additional context

No response

@marcusalstrom
Copy link

Is the issue that the Cargo.lock file is not being changed at all or is the issue that Cargo.lock is not being added to the commit?

@woile
Copy link
Member

woile commented Oct 6, 2024

The Cargo.lock is not being changed at all.

@marcusalstrom
Copy link

I attempted to reproduce this in my Rust project. After creating a commit with cz commit, I executed cz bump to update the version, and both the Cargo.toml and Cargo.lock files correctly reflected the version change.
How exactly can I reproduce this bug?

@woile
Copy link
Member

woile commented Oct 6, 2024

Normally if your editor is running, it will pick up changes to the folder, and run cargo commands which automatically update the .lock. That's why if you update the Cargo.toml manually, you will see it in the .lock.

Fixing this is actually a bit hard because of workspaces, and because you can define workspaces with globs, and exclude like:

[workspace]
members = ["crates/*"]
exclude = ["crates/foo"]

so you'd have to use glob.glob from python to include, and then exclude those matching the exclude, and afterwards filter from all the found crates those with version = { workspace = true }, and finally, the resulting crates should be updated on the .lock

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

4 participants