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

Support Workspace Releases #66

Closed
3 of 6 tasks
jan-auer opened this issue Jun 3, 2018 · 17 comments · Fixed by #114
Closed
3 of 6 tasks

Support Workspace Releases #66

jan-auer opened this issue Jun 3, 2018 · 17 comments · Fixed by #114
Labels
enhancement Improve the expected

Comments

@jan-auer
Copy link

jan-auer commented Jun 3, 2018

In workspace projects, it is often desired to create coordinated releases with all package versions bumped at the same time. This includes upgrading versions in dependent crates. It would be great to have some sort of workspace flag, that performs all upgrades in a single commit (and tag).


Maintainer Notes

Steps

@jan-auer
Copy link
Author

jan-auer commented Jun 3, 2018

If you like, I could start by putting a PR for this together. After looking at the code base, I think this would need some more refactoring. I would propose to move to cargo and toml-edit, and then add workspace updates in the next step.

@sunng87
Copy link
Collaborator

sunng87 commented Jun 3, 2018

Cool! Workspace support is always welcomed. Can toml-edit retain the format or any comments in toml file? That's the reason I was manually update the cargo file.

@jan-auer
Copy link
Author

jan-auer commented Jun 3, 2018

In the latest version it can. It is what cargo-edit uses under the hood.

I’ve got a local experiment running, will try to clean it up over the next days and create a pull request.

@sunng87
Copy link
Collaborator

sunng87 commented Jun 4, 2018

Thanks @jan-auer . Looking forward to your PR.

@spacekookie
Copy link
Contributor

Is there any news on this? This is currently breaking my workflow quite massively 🙁

@ufoscout
Copy link

This is interesting. Anyway, to be really useful, it should handle also dependencies specified by an internal "path":

[dependencies]
intra_workspace_lib = { path = "../intra_workspace_lib" }

@jan-auer
any progress with your PR?

@jan-auer
Copy link
Author

@ufoscout Unfortunately I haven't had enough time lately, and it turned out to be a major refactor. Not sure when I'll get back to this...

@spacekookie
Copy link
Contributor

@ufoscout @jan-auer I started working on this: https://github.com/spacekookie/cargo-ws-release

At the moment it's non functional but I will try to finish it next week (before RustConf craziness 😬)

It's approach is to build a dependency graph between workspace dependencies so that a release can bump appropriate versions in referencing crates.

There are a few simple issues someone could tackle if they wanted to help out before that.

@sunng87
Copy link
Collaborator

sunng87 commented Aug 1, 2018

@spacekookie that was great! Do you think it's good idea to make it a library, which generates an iterator that walks through the cargo workspace? We can then call cargo release on each crate iteratively.

@spacekookie
Copy link
Contributor

@sunng87 well, just calling cargo release on each crate in the workspace isn't enough though. The big problem I'm trying to solve is the updating of dependency versions after an update.

But yea, turning it into a library and integrating it into cargo release is probably not a bad idea down the road

@sunng87
Copy link
Collaborator

sunng87 commented Aug 1, 2018

yea, I think transform cargo-ws-release into a library can make it easier to integrate into cargo-release. Also I believe it could benefit some more scenarios.

JeanMertz added a commit to rustic-games/sm that referenced this issue Sep 14, 2018
cargo-release does not support workspace-wide releases (meaning, all
crates in the workspace should be updated to the same version in the
same commit).

There is ongoing work to make this possible:

* https://github.com/spacekookie/cargo-ws-release
* crate-ci/cargo-release#66

For the next couple of releases, I will follow in the footsteps of the
previous "cargo-release"-releases, and hopefully either workspace support
becomes available by then, or I find some spare cycles to help finish the
work that was started on that feature.
@epage
Copy link
Collaborator

epage commented Mar 7, 2019

Progress

  • Some parts of cargo-release are now relative to a manifest path rather than assuming CWD. More work to be done here
  • With Switch away from regex-based file editors #91, cargo-release will properly update the lock file within a workspace

Once I finish with #77, cargo-release will be able to handle releasing a crate-at-a-time within a workspace. Once the rest of cargo-release works off manifest path, it could then easily be extended to support a release-all-at-once.

@spacekookie
Copy link
Contributor

@epage have you had a look at spacekookie/cargo-ws-release#9 ?

@epage
Copy link
Collaborator

epage commented Mar 11, 2019

I had looked at cargo-ws-release but did not notice the PR. I'm unsure if ill get to adding --all support or just add minimal workspace support and the ground work for --all. My use case has me releasing each crate individually since my workspaces tend to have a stable -core separated from unstable implementations.

@epage epage added the enhancement Improve the expected label Mar 11, 2019
@epage
Copy link
Collaborator

epage commented Mar 17, 2019

So not ready to work directly on this yet but starting to give it some thought. For example, I think I'm going to create a clap-cargo crate that provides StructOpt structs for each set of flags (manifest path, workspace flags, etc). A user can just flatten them into their StructOpt struct like clap-verbosity.

I would want an optional feature to integrate with cargo-metadata to provide the information. For example, workspace support involves the following flags

  • manifest-path
  • all
  • package
  • exclude

We could provide a function on the workspace struct that partitions the cargo_metadata::Metadata::workspace_members into "process" and "exclude" sets based on the interaction of the above flags.

So one thing I'll need to know is how these flags interact. If anyone knows already, great! Otherwise, I'll have to either figure it out empirically or by digging into the code.

Examples of things to know

  • When interacting with other workspace flags, does cargo assume anything special when manifest-path is not specified?
  • If the current manifest is not the workspace root, it defaults to only the package in the manifest. Does specifying package override that? error? add? Is package repeatable?

EDITS:

@epage
Copy link
Collaborator

epage commented Apr 8, 2019

clap-cargo now exists.

@epage
Copy link
Collaborator

epage commented May 8, 2019

We now have layered config, including a config in the workspace root. See #111

epage added a commit to epage/cargo-release that referenced this issue May 24, 2019
This is effectively calling `cargo-release` for each package.  For
example, it does nothing to consolidate verson bump commits before or
after the release.

This uses `clap-cargo` to try to mirror `cargo`s logic for selecting
packages within a workspace.

This does have a bug wherein the packages are not released in dependency
order.

Fixes crate-ci#66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve the expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants