Skip to content

Commit

Permalink
chore: drop custom +~ version switching
Browse files Browse the repository at this point in the history
as this feature is in sbt since sbt/sbt#6894
and sbt/sbt#6936
  • Loading branch information
raboof committed May 13, 2024
1 parent ebcffc7 commit c66453b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nightly-1.0-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
# No need to specify the full Scala version. Only the Scala
# binary version is required and Pekko build will set the right
# full version from it.
scalaVersion: ["2.12", "2.13", "3.3"]
scalaVersion: ["2.12.x", "2.13.x", "3.3.x"]
javaVersion: [8, 11, 17, 21]
steps:
- name: Checkout
Expand Down Expand Up @@ -142,4 +142,4 @@ jobs:
-Dpekko.actor.testkit.typed.timefactor=2 \
-Dpekko.test.tags.exclude=gh-exclude,timing \
-Dpekko.test.multi-in-test=false \
clean "+~ ${{ matrix.scalaVersion }} test" checkTestsHaveRun
clean "++ ${{ matrix.scalaVersion }} test" checkTestsHaveRun
4 changes: 2 additions & 2 deletions .github/workflows/nightly-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
# No need to specify the full Scala version. Only the Scala
# binary version is required and Pekko build will set the right
# full version from it.
scalaVersion: ["2.12", "2.13", "3.3"]
scalaVersion: ["2.12.x", "2.13.x", "3.3.x"]
javaVersion: [8, 11, 17, 21]
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
-Dpekko.actor.testkit.typed.timefactor=2 \
-Dpekko.test.tags.exclude=gh-exclude,timing \
-Dpekko.test.multi-in-test=false \
clean "+~ ${{ matrix.scalaVersion }} test" checkTestsHaveRun
clean "++ ${{ matrix.scalaVersion }} test" checkTestsHaveRun
# comment out test report until an apache or GitHub published action (action-surefire-report) can be found or added allowlist from INFRA
# - name: Test Reports
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scala3-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
-Dmultinode.Xms256M \
-Dmultinode.Xmx256M \
-Dmultinode.XX:+AlwaysActAsServerClassMachine \
"+~ 3 ${{ matrix.command }}"
"++ 3.x ${{ matrix.command }}"
# comment out email actions until we have an email address to use (and we need to get INFRA to whitelist dawidd6/action-send-mail)
#- name: Email on failure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scala3-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ jobs:
DEVELOCITY_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
run: |
sbt \
"+~ 3 ${{ matrix.command }}"
"++ 3.x ${{ matrix.command }}"
27 changes: 0 additions & 27 deletions project/PekkoBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ object PekkoBuild {
val parallelExecutionByDefault = false // TODO: enable this once we're sure it does not break things

lazy val rootSettings = Def.settings(
commands += switchVersion,
UnidocRoot.pekkoSettings,
Protobuf.settings,
GlobalScope / parallelExecution := System
Expand Down Expand Up @@ -346,30 +345,4 @@ object PekkoBuild {
}

def majorMinor(version: String): Option[String] = """\d+\.\d+""".r.findFirstIn(version)

// So we can `sbt "+~ 3 clean compile"`
//
// The advantage over `++` is twofold:
// * `++` also requires the patch version, `+~` finds the first supported Scala version that matches the prefix (if any)
// * When subprojects need to be excluded, ++ needs to be specified for each command
//
// So the `++` equivalent of the above example is `sbt "++ 3.1.2 clean" "++ 3.1.2 compile"`
val switchVersion: Command = Command.args("+~", "<version> <args>") { (initialState: State, args: Seq[String]) =>
{
val requestedVersionPrefix = args.head
val requestedVersion = Dependencies.allScalaVersions.filter(_.startsWith(requestedVersionPrefix)).head

def run(state: State, command: String): State = {
val parsed = s"++ $requestedVersion $command".foldLeft(Cross.switchVersion.parser(state))((p, i) => p.derive(i))
parsed.resultEmpty match {
case e: sbt.internal.util.complete.Parser.Failure =>
throw new IllegalStateException(e.errors.mkString(", "))
case sbt.internal.util.complete.Parser.Value(v) =>
v()
}
}
val commands = args.tail
commands.foldLeft(initialState)(run)
}
}
}

0 comments on commit c66453b

Please sign in to comment.