-
Notifications
You must be signed in to change notification settings - Fork 76
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
Implement back publishing support #322
Conversation
Would be great to have the DSL explained in the README |
@mzuehlke I'd be happy to add documentation before merging this, but I didn't know how this PR would be received so first I wanted to float the idea and see what people thought on if we should do it, and if the syntax looks ok. |
Makes sense. Sorry for nagging |
Constructive feedbacks are always welcome :) |
I'm strongly in favor of this. I never really understood @olafurpg's and @dwijnand's objections on #102, and the lack of this feature has, for some years now, been steadily wasting small amounts of my time — but those amounts add up! — in a lot of repos that I work in. And the workaround of never backpublishing ends up wasting a much larger amount of time downstream, as a large number of people have to try to figure out what versions of things they need to be using. The amount of time wasted per person is pretty small, but again, it adds up. |
@lrytz any thoughts on the syntax? I think it was you who designed the similar thing we did for the Scala modules |
Syntax looks fine. I wonder more if it is generic enough. Could we think of some concrete examples and how they would be addressed? E.g., re-release 1.2.3 of some library for a new version of Scala Native? |
case 1.allPublish all subprojects for a new Scala version case 1.sub (to be impl)Publish one subproject for a new Scala version
User can define a new command or a subproject to aggregate 2 or more subprojects. lazy val backPublishProj = (project in file("backPublish))
.aggregate(foo, bar)
.settings(publish / skip := true)
case 2Republish for 3.x (sbt plugin likely would do this)
case 3Publish one subproject for a new sbt plugin like Scala.JS or Scala Native.
|
Reading the code, it seems like the I assume this means that these branches/tags will exist for the whole set of supported version combinations that might exist. A scalaJS + multiScalaVersion sbt plugin is going to be pushing a lot of tags. |
Not sure what you mean here. I'm proposing this mechanism for back publishing purpose only, which means that a normal tag like |
OK, so the goal is not to handle each and every scenario only through the tag name. I think that's good, it would be way too open ended otherwise. One could argue, if you have to create a branch with some patches for the backpublishing anyway, Branching is not needed to publish for a new Scala version, but that's only useful for fully cross-versioned projects, like compiler plugins. |
Yea, technically you can hardcode version, release command etc all in a branch, which is the reason the original issue was closed. The benefit this PR could bring is making the process a bit smoother by removing the hardcoding. For example, if we bumped up the Scala Native version in a branch, that branch can still merge back into |
The feature of dropping a So maybe that basic feature, plus documentation how to narrow down the build to publish only specific artifacts, is enough? |
The comment only route of the documentation would look like.. Case n: Publish some subprojects for Scala 3.x
If some project wants to do that, they can do that, but I now you have to look at both the build and the YAML to understand what's going on, and the YAML is different for different CI systems (a committer may not even have access to change it, in case of Jenkins). |
Thanks Eugene. In any case, this PR enables the comment-only workflow you describe. If the additional feature is helpful, then I guess why not? I'm not a maintainer here and I'm certainly not going to be in the way :) |
**Problem** For plugin code, like sbt plugins and Scala compiler plugin, and even normal libraries, it's common for the maintainers to want to back publish the current code base against a new version of Scala (or sbt, Scala Nave etc) instead of bumping the version. The current "bump the version" approach effectively pushes the work of figuring out the correct patch version number to the end users. In addition, if the plugin or the library does not cross publish all variants, then the end user might need to figure out different patch version to use effectively the same code. **Solution** This implements a mini DSL for tag `version[@command|@3.3.4][#comment]`, which allows plugin authors to back publish a code base.
773481d
to
4cd48ae
Compare
Fixes #102
Ref scalameta/metals#3557
Ref typelevel/kind-projector#206
Ref https://github.com/scala/scala-parser-combinators/blob/d2e6685145ca4a9298c3d2ac0bde5ccf090f5d99/build.sh#L13-L15
Problem
For plugin code, like sbt plugins and Scala compiler plugin, and even normal libraries, it's common for the maintainers to want to back publish the current code base against a new version of Scala (or sbt, Scala Native etc) instead of bumping the version.
The current "bump the version" approach effectively pushes the work of figuring out the correct patch version number to the end users. In addition, if the plugin or the library does not cross publish all variants, then the end user might need to figure out different patch version to use effectively the same code.
Solution
This implements a mini DSL for tag:
, which allows plugin authors to back publish a code base. A back-publish tag is split via
@
character, and uses#
to denote comments. The comment is useful when multiple tags must be made pointing to the same version, which might be needed to recover from failures or for sbt plugin migration.@a.b."x"
for example@3.x
expands to;++3.x;publishSigned
@a.b.c
for example@2.12.20
expands to;++2.12.20!;publishSigned
@command
for example@foo/publishSigned
expands tofoo/publishSigned
For example, to back publish sbt-pgp plugin 2.3.0, we will tag
[email protected]#sbt-2.0.0-M3
.