summaryrefslogtreecommitdiff
path: root/scalalib/src
diff options
context:
space:
mode:
authorNikolay Tatarinov <5min4eq.unity@gmail.com>2018-03-20 18:20:38 +0300
committerGitHub <noreply@github.com>2018-03-20 18:20:38 +0300
commitcb30f1c42c818b2a2b1e216823ca09c8430da5f9 (patch)
treed1f7e50547ab10c28bff562924a53c31a86e728c /scalalib/src
parent672642e4694088c2c0aee6e408de079318bcd4db (diff)
downloadmill-cb30f1c42c818b2a2b1e216823ca09c8430da5f9.tar.gz
mill-cb30f1c42c818b2a2b1e216823ca09c8430da5f9.tar.bz2
mill-cb30f1c42c818b2a2b1e216823ca09c8430da5f9.zip
Support scala milestone releases (with fixes for 2.13.0-M3) (#247)
* return full scala version for milestone releases * complete support for scala 2.13.0-M2 * match 2.13 milestone releases for compiler bridge sources * add hello world test case for scala 2.13.0-M3
Diffstat (limited to 'scalalib/src')
-rw-r--r--scalalib/src/mill/scalalib/Lib.scala11
-rw-r--r--scalalib/src/mill/scalalib/ScalaModule.scala15
-rw-r--r--scalalib/src/mill/scalalib/ScalaWorkerApi.scala2
3 files changed, 22 insertions, 6 deletions
diff --git a/scalalib/src/mill/scalalib/Lib.scala b/scalalib/src/mill/scalalib/Lib.scala
index d8fd9963..e6a7a255 100644
--- a/scalalib/src/mill/scalalib/Lib.scala
+++ b/scalalib/src/mill/scalalib/Lib.scala
@@ -16,7 +16,16 @@ case class CompilationResult(analysisFile: Path, classes: PathRef)
object Lib{
- def scalaBinaryVersion(scalaVersion: String) = scalaVersion.split('.').dropRight(1).mkString(".")
+ private val ReleaseVersion = raw"""(\d+)\.(\d+)\.(\d+)""".r
+ private val MinorSnapshotVersion = raw"""(\d+)\.(\d+)\.([1-9]\d*)-SNAPSHOT""".r
+
+ def scalaBinaryVersion(scalaVersion: String) = {
+ scalaVersion match {
+ case ReleaseVersion(major, minor, _) => s"$major.$minor"
+ case MinorSnapshotVersion(major, minor, _) => s"$major.$minor"
+ case _ => scalaVersion
+ }
+ }
def grepJar(classPath: Agg[Path], s: String) = {
classPath
diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala
index 0fe7e3dc..b5106e3e 100644
--- a/scalalib/src/mill/scalalib/ScalaModule.scala
+++ b/scalalib/src/mill/scalalib/ScalaModule.scala
@@ -98,13 +98,20 @@ trait ScalaModule extends mill.Module with TaskModule { outer =>
def platformSuffix = T{ "" }
- def scalaCompilerBridgeSources = T{
+ private val Milestone213 = raw"""2.13.(\d+)-M(\d+)""".r
+
+ def scalaCompilerBridgeSources = T {
+ val (scalaVersion0, scalaBinaryVersion0) = scalaVersion() match {
+ case Milestone213(_, _) => ("2.13.0-M2", "2.13.0-M2")
+ case _ => (scalaVersion(), Lib.scalaBinaryVersion(scalaVersion()))
+ }
+
resolveDependencies(
repositories,
- scalaVersion(),
+ scalaVersion0,
Seq(ivy"org.scala-sbt::compiler-bridge:1.1.0"),
sources = true
- )
+ ).map(_.find(_.path.last == s"compiler-bridge_${scalaBinaryVersion0}-1.1.0-sources.jar").map(_.path).get)
}
def scalacPluginClasspath: T[Agg[PathRef]] = T {
@@ -154,7 +161,7 @@ trait ScalaModule extends mill.Module with TaskModule { outer =>
scalaWorker.worker().compileScala(
scalaVersion(),
allSourceFiles().map(_.path),
- scalaCompilerBridgeSources().map(_.path),
+ scalaCompilerBridgeSources(),
compileClasspath().map(_.path),
scalaCompilerClasspath().map(_.path),
scalacOptions(),
diff --git a/scalalib/src/mill/scalalib/ScalaWorkerApi.scala b/scalalib/src/mill/scalalib/ScalaWorkerApi.scala
index 84db1dd8..a3760aed 100644
--- a/scalalib/src/mill/scalalib/ScalaWorkerApi.scala
+++ b/scalalib/src/mill/scalalib/ScalaWorkerApi.scala
@@ -54,7 +54,7 @@ trait ScalaWorkerModule extends mill.Module{
trait ScalaWorkerApi {
def compileScala(scalaVersion: String,
sources: Agg[Path],
- compileBridgeSources: Agg[Path],
+ compilerBridgeSources: Path,
compileClasspath: Agg[Path],
compilerClasspath: Agg[Path],
scalacOptions: Seq[String],