diff options
author | Guillaume R <theelectronwill@gmail.com> | 2019-07-25 01:14:09 +0200 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2019-07-25 07:14:09 +0800 |
commit | 4e3bcc9eeb8e3b6b13f29cb63360a512c0f6ed9b (patch) | |
tree | 0a985d7bd97c66582c93b3e8d6989c91329cb8f6 /scalalib/api/src/ZincWorkerApi.scala | |
parent | 1f0d223c1de438071645c7788174fb708ca55043 (diff) | |
download | mill-4e3bcc9eeb8e3b6b13f29cb63360a512c0f6ed9b.tar.gz mill-4e3bcc9eeb8e3b6b13f29cb63360a512c0f6ed9b.tar.bz2 mill-4e3bcc9eeb8e3b6b13f29cb63360a512c0f6ed9b.zip |
Use the binary version of the compiler bridge when available (#659)
* Use the binary version of the compiler bridge when available, fix #591
This also eliminates #389 for Dotty 0.13.0-RC1 and more recent
* Add test for Dotty 0.16
Diffstat (limited to 'scalalib/api/src/ZincWorkerApi.scala')
-rw-r--r-- | scalalib/api/src/ZincWorkerApi.scala | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/scalalib/api/src/ZincWorkerApi.scala b/scalalib/api/src/ZincWorkerApi.scala index 790ea274..0480e8e6 100644 --- a/scalalib/api/src/ZincWorkerApi.scala +++ b/scalalib/api/src/ZincWorkerApi.scala @@ -45,7 +45,7 @@ object CompilationResult { // analysisFile is represented by os.Path, so we won't break caches after file changes case class CompilationResult(analysisFile: os.Path, classes: PathRef) -object Util{ +object Util { def isDotty(scalaVersion: String) = scalaVersion.startsWith("0.") @@ -66,16 +66,22 @@ 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 TypelevelVersion = raw"""(\d+)\.(\d+)\.(\d+)-bin-typelevel.*""".r - def scalaBinaryVersion(scalaVersion: String) = { - scalaVersion match { + 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 TypelevelVersion(major, minor, _) => s"$major.$minor" case _ => scalaVersion - } } -}
\ No newline at end of file + + /** @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 _ => false + } +} |