-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**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.
- Loading branch information
Showing
5 changed files
with
162 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ jobs: | |
java-version: 8 | ||
cache: sbt | ||
- uses: sbt/setup-sbt@v1 | ||
- run: sbt +compile | ||
- run: sbt +test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.geirsson | ||
|
||
import CiReleasePlugin.{ backPubVersionToCommand, dropBackPubCommand } | ||
|
||
class CiReleaseTest extends munit.FunSuite { | ||
val expectedVer = "1.1.0" | ||
|
||
test("Normal version default") { | ||
assertEquals(backPubVersionToCommand("1.1.0"), "+publishSigned") | ||
assertEquals(dropBackPubCommand("1.1.0"), expectedVer) | ||
} | ||
|
||
test("Command starting with number is assumed to be a cross version") { | ||
assertEquals(backPubVersionToCommand("1.1.0@2.12.20"), ";++2.12.20!;publishSigned") | ||
assertEquals(dropBackPubCommand("1.1.0@2.12.20"), expectedVer) | ||
|
||
assertEquals(backPubVersionToCommand("1.1.0@3.x"), ";++3.x;publishSigned") | ||
assertEquals(dropBackPubCommand("1.1.0@3.x"), expectedVer) | ||
} | ||
|
||
test("Non-number is treated as an alternative publish command") { | ||
assertEquals(backPubVersionToCommand("1.1.0@foo/publishSigned"), "foo/publishSigned") | ||
assertEquals(dropBackPubCommand("1.1.0@foo/publishSigned"), expectedVer) | ||
|
||
assertEquals(backPubVersionToCommand("1.1.0@+foo/publishSigned"), "+foo/publishSigned") | ||
assertEquals(dropBackPubCommand("1.1.0@+foo/publishSigned"), expectedVer) | ||
} | ||
|
||
test("Commands can be chained") { | ||
assertEquals(backPubVersionToCommand("1.1.0@2.12.20@foo/publishSigned"), ";++2.12.20!;foo/publishSigned") | ||
assertEquals(dropBackPubCommand("1.1.0@2.12.20@foo/publishSigned"), expectedVer) | ||
|
||
assertEquals(backPubVersionToCommand("1.1.0@foo/something@bar/publishSigned"), ";foo/something;bar/publishSigned") | ||
assertEquals(dropBackPubCommand("1.1.0@foo/something@bar/publishSigned"), expectedVer) | ||
} | ||
|
||
test("Treat # as comments") { | ||
assertEquals(backPubVersionToCommand("1.1.0#comment"), "+publishSigned") | ||
assertEquals(dropBackPubCommand("1.1.0#comment"), expectedVer) | ||
|
||
assertEquals(backPubVersionToCommand("1.1.0@2.12.20#comment"), ";++2.12.20!;publishSigned") | ||
assertEquals(dropBackPubCommand("1.1.0@2.12.20#comment"), expectedVer) | ||
|
||
assertEquals(backPubVersionToCommand("1.1.0@3.x#comment"), ";++3.x;publishSigned") | ||
assertEquals(dropBackPubCommand("1.1.0@3.x#comment"), expectedVer) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters