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

Add support for workspace-wide version setting and bumping #814

Merged
merged 8 commits into from
Oct 6, 2022

Conversation

poliorcetics
Copy link
Contributor

This PR adds support for the workspace.package.version added in Cargo 1.64.0.

I tried to make very atomic commits to make it easier to review since it needed
quite some refactoring, I advise to review commit by commit else it will be quite
heavy to read.

Closes #752

Copy link
Collaborator

@epage epage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of this!

tests/cmd/set-version/upgrade_compatible_dependency.toml Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/bin/set-version/set_version.rs Outdated Show resolved Hide resolved
src/bin/set-version/set_version.rs Outdated Show resolved Hide resolved
@poliorcetics
Copy link
Contributor Author

@epage so the wanted behavior is to update the workspace-wide version if one of the two is true:

  1. --workspace was given
  2. --package <pkg> was given where pkg's version is inherited from the workspace

Is that correct ?

@poliorcetics poliorcetics force-pushed the set-version-workspace branch 3 times, most recently from a57f554 to 58718a2 Compare September 29, 2022 13:31
@poliorcetics
Copy link
Contributor Author

All fixed, there is only the one question about --workspace-version merging with --workspace (and loosing the conflict with --exclude) or not

@epage
Copy link
Collaborator

epage commented Sep 30, 2022

Sorry for the delay; got caught up in clap v4 release stuff.

@epage so the wanted behavior is to update the workspace-wide version if one of the two is true:

1. `--workspace` was given

2. `--package <pkg>` was given where `pkg`'s version is inherited from the workspace

Is that correct ?

All fixed, there is only the one question about --workspace-version merging with --workspace (and loosing the conflict with --exclude) or not

A simpler take is that if a package is specified that uses version.workspace = true then we automatically update it.

We already have command-line flag processing separated from iterating over workspace members, so we can just keep that.

@poliorcetics
Copy link
Contributor Author

Sorry for the delay; got caught up in clap v4 release stuff.

No worries, you don't owe me any of your free time 😄


I fixed a bug where workspace declared in the same Cargo.toml as a regular crate would update all the workspace.dependencies, regardless of if they were concerned by the update and addressed your comments.

I hope there aren't more bugs I missed, I think I tested pretty much everything now 😅

@epage
Copy link
Collaborator

epage commented Oct 4, 2022

FYI there are some things that aren't quite working out for me with this PR. I think part of it is the base you are working off of. I'm trying to get some changes made that will make adding workspace inheritance more comprehensible.

@epage
Copy link
Collaborator

epage commented Oct 4, 2022

Alright, things are in better shape.

My assumption is that we will partition the selected manifests into two groups: those inheriting and those that aren't. When we call update_dependents for the inheriting case, we pass in a &[PathBuf] of all of the dep crate roots that use workspace dependencies. We likely don't need more logic split out into new functions. Forcing code sharing when it doesn't quite work can make the code harder to follow than easier.

@poliorcetics
Copy link
Contributor Author

poliorcetics commented Oct 5, 2022

So I can close this ? Seems like you added the code to support it ?

Ah no, workspace.version is not updated correctly yet

@poliorcetics
Copy link
Contributor Author

Rebased, it was indeed much much simpler

Copy link
Collaborator

@epage epage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, even cleaner than I expected! Good job on finding such a simple solution! I hadn't thought to take advantage of the existing update_dependents

src/bin/set-version/set_version.rs Outdated Show resolved Hide resolved
src/bin/set-version/set_version.rs Outdated Show resolved Hide resolved
@poliorcetics poliorcetics force-pushed the set-version-workspace branch 2 times, most recently from b09a2bb to 4b8120d Compare October 6, 2022 07:04
@epage
Copy link
Collaborator

epage commented Oct 6, 2022

Thanks!

@epage epage merged commit 7d50966 into killercup:master Oct 6, 2022
@poliorcetics poliorcetics deleted the set-version-workspace branch October 6, 2022 18:30
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

Successfully merging this pull request may close these issues.

Support workspace inheritance in cargo-set-version
2 participants