summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2019-07-29 13:52:46 +0200
committerLi Haoyi <haoyi.sg@gmail.com>2019-07-29 19:52:46 +0800
commit1a05b8d392e5d2eef36fc0ea4fd1e43b10cebd36 (patch)
tree5701cfd7199472461e618546ad6559a325f4f5cc
parent512d09d8e02152429da7ba897882f242efb5f193 (diff)
downloadmill-1a05b8d392e5d2eef36fc0ea4fd1e43b10cebd36.tar.gz
mill-1a05b8d392e5d2eef36fc0ea4fd1e43b10cebd36.tar.bz2
mill-1a05b8d392e5d2eef36fc0ea4fd1e43b10cebd36.zip
Future-proof Dotty-version checks (#663)
Prepare for 3.x, like in zinc itself: https://github.com/sbt/zinc/pull/678
-rw-r--r--scalalib/api/src/ZincWorkerApi.scala13
1 files changed, 7 insertions, 6 deletions
diff --git a/scalalib/api/src/ZincWorkerApi.scala b/scalalib/api/src/ZincWorkerApi.scala
index 0480e8e6..418b18c6 100644
--- a/scalalib/api/src/ZincWorkerApi.scala
+++ b/scalalib/api/src/ZincWorkerApi.scala
@@ -47,7 +47,8 @@ case class CompilationResult(analysisFile: os.Path, classes: PathRef)
object Util {
def isDotty(scalaVersion: String) =
- scalaVersion.startsWith("0.")
+ scalaVersion.startsWith("0.") ||
+ scalaVersion.startsWith("3.")
def grepJar(classPath: Agg[os.Path], name: String, version: String, sources: Boolean = false) = {
@@ -65,23 +66,23 @@ object Util {
private val ReleaseVersion = raw"""(\d+)\.(\d+)\.(\d+)""".r
private val MinorSnapshotVersion = raw"""(\d+)\.(\d+)\.([1-9]\d*)-SNAPSHOT""".r
- private val DottyVersion = raw"""0\.(\d+)\.(\d+).*""".r
- private val DottyNightlyVersion = raw"""0\.(\d+)\.(\d+)-bin-(.*)-NIGHTLY""".r
+ private val DottyVersion = raw"""(0|3)\.(\d+)\.(\d+).*""".r
+ private val DottyNightlyVersion = raw"""(0|3)\.(\d+)\.(\d+)-bin-(.*)-NIGHTLY""".r
private val TypelevelVersion = raw"""(\d+)\.(\d+)\.(\d+)-bin-typelevel.*""".r
def scalaBinaryVersion(scalaVersion: String) = scalaVersion match {
case ReleaseVersion(major, minor, _) => s"$major.$minor"
case MinorSnapshotVersion(major, minor, _) => s"$major.$minor"
- case DottyVersion(minor, _) => s"0.$minor"
+ case DottyVersion("0", minor, _) => s"0.$minor"
case TypelevelVersion(major, minor, _) => s"$major.$minor"
case _ => scalaVersion
}
/** @return true if the compiler bridge can be downloaded as an already compiled jar */
def isBinaryBridgeAvailable(scalaVersion: String) = scalaVersion match {
- case DottyNightlyVersion(minor, _, _) => minor.toInt >= 14 // 0.14.0-bin or more (not 0.13.0-bin)
- case DottyVersion(minor, _) => minor.toInt >= 13 // 0.13.0-RC1 or more
+ case DottyNightlyVersion(major, minor, _, _) => major.toInt > 0 || minor.toInt >= 14 // 0.14.0-bin or more (not 0.13.0-bin)
+ case DottyVersion(major, minor, _) => major.toInt > 0 || minor.toInt >= 13 // 0.13.0-RC1 or more
case _ => false
}
}