Skip to content

Commit

Permalink
Merge pull request #384 from adpi2/fix-6585
Browse files Browse the repository at this point in the history
Fix Scala 3 binary version
  • Loading branch information
eed3si9n committed Jul 9, 2021
2 parents 40a2166 + 37234e3 commit 5ef0af2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ object CrossVersionUtil {
}

private[sbt] def binaryScala3Version(full: String): String = full match {
case ReleaseV(maj, _, _, _) => maj
case CandidateV(maj, min, patch, _) if min.toLong > 0 || patch.toLong > 0 => maj
case MilestonV(maj, min, patch, _) if min.toLong > 0 || patch.toLong > 0 => maj
case BinCompatV(maj, min, patch, stage, _) => binaryScala3Version(s"$maj.$min.$patch$stage")
case _ => full
case ReleaseV(maj, _, _, _) => maj
case NonReleaseV_n(maj, min, patch, _) if min.toLong > 0 || patch.toLong > 0 => maj
case BinCompatV(maj, min, patch, stageOrNull, _) =>
val stage = if (stageOrNull != null) stageOrNull else ""
binaryScala3Version(s"$maj.$min.$patch$stage")
case _ => full
}

def binaryScalaVersion(full: String): String = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,13 @@ class CrossVersionTest extends UnitSpec {
binaryScalaVersion("3.0.1-M1") shouldBe "3"
}
it should "for 3.0.1-RC1-bin-SNAPSHOT return 3" in {
binaryScalaVersion("3.0.1-RC1") shouldBe "3"
binaryScalaVersion("3.0.1-RC1-bin-SNAPSHOT") shouldBe "3"
}
it should "for 3.0.1-bin-nonbootstrapped return 3" in {
binaryScalaVersion("3.0.1-bin-SNAPSHOT") shouldBe "3"
}
it should "for 3.0.1-SNAPSHOT return 3" in {
binaryScalaVersion("3.0.1-SNAPSHOT") shouldBe "3"
}

private def patchVersion(fullVersion: String) =
Expand Down

0 comments on commit 5ef0af2

Please sign in to comment.