Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
SethTisue committed Jul 8, 2022
1 parent 331266e commit 6676e4e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ inThisBuild {

val platformSuffix = if (isScalaJs) "JS" else if (isScalaNative) "Native" else ""

val compatProject = "compat" + ciScalaVersion.get.binary + platformSuffix
val compatProject = s"compat${ciScalaVersion.get}$platformSuffix"
val binaryCompatProject = "binaryCompat"

val testProjectPrefix =
Expand All @@ -394,7 +394,7 @@ inThisBuild {
}

Seq(
List(s"""++${sys.env.get("CI_SCALA_VERSION").get}!"""),
List(s"""++${sys.env.get("CI_SCALA_VERSION").get}"""),
List(s"$projectPrefix/clean"),
List(s"$testProjectPrefix/test"),
List(s"$projectPrefix/publishLocal"),
Expand Down
24 changes: 12 additions & 12 deletions project/Version.scala
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
case class Version(major: Int, minor: Int, patch: Int) {
def binary: String = s"${major}${minor}"
override def toString: String = s"${major}.${minor}.${patch}"
case class Version(major: Int, minor: Int) {
override def toString = s"${major}${minor}"
}

object Version {
// the (#.+)? part allows republishing for a new Scala version
private val versionRegex0 = "v?([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:#.+)?".r
private val versionRegex1 = "v?([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.+)(?:#.+)?".r
// `(#.+)?` allows republishing for a new Scala version
// `|x` allows the sbt 1.7 style ".x" versions
private val versionRegex0 = "v?([0-9]+)\\.([0-9]+)\\.([0-9]+|x)(?:#.+)?".r
private val versionRegex1 = "v?([0-9]+)\\.([0-9]+)\\.([0-9]+|x)-(.+)(?:#.+)?".r
private val versionRegex2 = "([0-9]+)\\.([0-9]+)(?:#.+)?".r
private val versionRegex3 = "([0-9]+)(?:#.+)?".r
def parse(raw: String): Option[Version] = {
raw match {
case versionRegex0(major, minor, patch) =>
Some(Version(major.toInt, minor.toInt, patch.toInt))
case versionRegex1(major, minor, patch, _) =>
Some(Version(major.toInt, minor.toInt, patch.toInt))
case versionRegex0(major, minor, _) =>
Some(Version(major.toInt, minor.toInt))
case versionRegex1(major, minor, _, _) =>
Some(Version(major.toInt, minor.toInt))
case versionRegex2(major, minor) =>
Some(Version(major.toInt, minor.toInt, 0))
Some(Version(major.toInt, minor.toInt))
case versionRegex3(major) =>
Some(Version(major.toInt, 0, 0))
Some(Version(major.toInt, 0))
case _ =>
None
}
Expand Down

0 comments on commit 6676e4e

Please sign in to comment.