summaryrefslogtreecommitdiff
path: root/build.sc
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2017-12-06 20:53:29 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2017-12-06 20:54:04 -0800
commit7239d6bd64ec0d025686f5f97aaaf94b7ab43951 (patch)
treeada5a410d1ee7d658d98e3b57e4188d013109451 /build.sc
parent7a1b339b08a7e6b99da7d98b1856d534c207c99e (diff)
downloadmill-7239d6bd64ec0d025686f5f97aaaf94b7ab43951.tar.gz
mill-7239d6bd64ec0d025686f5f97aaaf94b7ab43951.tar.bz2
mill-7239d6bd64ec0d025686f5f97aaaf94b7ab43951.zip
Explicitly pass built compiler-bridge jar locations from the build system into Mill as JVM properties.
This makes the dependency between the compiler-bridge jar and the Mill executable explicit, allowing us to swap out the locations compiler-bridge jars (which end up in different places, depending on whether you're building with SBT or Mill) or eventually making them load from Maven Central in a "release" Mill executable Since Mill (and uTest) both do not support SBT-style test arguments, we need to use `forkTest` instead of `test` to run the Mill tests passing the compiler-jar locations as JVM props. This necessitated some fixes to make `forkTest` behave properly
Diffstat (limited to 'build.sc')
-rwxr-xr-xbuild.sc21
1 files changed, 15 insertions, 6 deletions
diff --git a/build.sc b/build.sc
index 7b261892..5d581364 100755
--- a/build.sc
+++ b/build.sc
@@ -5,7 +5,10 @@ import mill.scalaplugin._
trait MillModule extends ScalaModule{ outer =>
def scalaVersion = "2.12.4"
override def sources = basePath/'src/'main/'scala
+ def testArgs = T{ Seq.empty[String] }
object test extends this.Tests{
+ override def defaultCommandName() = "forkTest"
+ override def forkArgs = T{ testArgs() }
override def projectDeps =
if (this == Core.test) Seq(Core)
else Seq(outer, Core.test)
@@ -80,14 +83,20 @@ object ScalaPlugin extends MillModule {
override def projectDeps = Seq(Core)
def basePath = pwd / 'scalaplugin
override def compile = T.persistent[mill.eval.PathRef]{
- bridges("2.10.6").compile()
- bridges("2.11.8").compile()
- bridges("2.11.11").compile()
- bridges("2.12.3").compile()
- bridges("2.12.4").compile()
super.compile()
}
+ override def testArgs = T{
+ val mapping = Map(
+ "MILL_COMPILER_BRIDGE_2_10_6" -> bridges("2.10.6").compile().path,
+ "MILL_COMPILER_BRIDGE_2_11_8" -> bridges("2.11.8").compile().path,
+ "MILL_COMPILER_BRIDGE_2_11_11" -> bridges("2.11.11").compile().path,
+ "MILL_COMPILER_BRIDGE_2_12_3" -> bridges("2.12.3").compile().path,
+ "MILL_COMPILER_BRIDGE_2_12_4" -> bridges("2.12.4").compile().path,
+ )
+ for((k, v) <- mapping.toSeq) yield s"-D$k=$v"
+ }
+
override def prependShellScript =
"#!/usr/bin/env sh\n" +
- """exec java $JAVA_OPTS -cp "$0" mill.Main "$@" """
+ s"""exec java ${testArgs().mkString(" ")} $$JAVA_OPTS -cp "$$0" mill.Main "$$@" """
}