diff options
Diffstat (limited to 'scalalib')
-rw-r--r-- | scalalib/src/mill/scalalib/ScalaModule.scala | 13 | ||||
-rw-r--r-- | scalalib/src/mill/scalalib/ScalaWorkerApi.scala | 12 |
2 files changed, 12 insertions, 13 deletions
diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala index bbfd4b27..cc2d1e84 100644 --- a/scalalib/src/mill/scalalib/ScalaModule.scala +++ b/scalalib/src/mill/scalalib/ScalaModule.scala @@ -33,7 +33,7 @@ trait ScalaModule extends mill.Module with TaskModule { outer => mainClass() match { case Some(main) => Result.Success(main) case None => - scalaWorker.scalaWorker().discoverMainClasses(compile()) match { + scalaWorker.worker().discoverMainClasses(compile()) match { case Seq() => Result.Failure("No main class specified or found") case Seq(main) => Result.Success(main) case mains => @@ -84,10 +84,7 @@ trait ScalaModule extends mill.Module with TaskModule { outer => } - def repositories: Seq[Repository] = Seq( - Cache.ivy2Local, - MavenRepository("https://repo1.maven.org/maven2") - ) + def repositories: Seq[Repository] = scalaWorker.repositories def platformSuffix = T{ "" } @@ -141,7 +138,7 @@ trait ScalaModule extends mill.Module with TaskModule { outer => } yield PathRef(path) } def compile: T[CompilationResult] = T.persistent{ - scalaWorker.scalaWorker().compileScala( + scalaWorker.worker().compileScala( scalaVersion(), allSourceFiles().map(_.path), scalaCompilerBridgeSources().map(_.path), @@ -341,7 +338,7 @@ trait TestModule extends ScalaModule with TaskModule { Jvm.subprocess( mainClass = "mill.scalaworker.ScalaWorker", - classPath = scalaWorker.scalaWorkerClasspath(), + classPath = scalaWorker.classpath(), jvmArgs = forkArgs(), envArgs = forkEnv(), mainArgs = Seq( @@ -363,7 +360,7 @@ trait TestModule extends ScalaModule with TaskModule { def testLocal(args: String*) = T.command{ val outputPath = T.ctx().dest/"out.json" - scalaWorker.scalaWorker().runTests( + scalaWorker.worker().runTests( TestRunner.frameworks(testFrameworks()), runClasspath().map(_.path), Agg(compile().classes.path), diff --git a/scalalib/src/mill/scalalib/ScalaWorkerApi.scala b/scalalib/src/mill/scalalib/ScalaWorkerApi.scala index 883cd30e..2d04ac4e 100644 --- a/scalalib/src/mill/scalalib/ScalaWorkerApi.scala +++ b/scalalib/src/mill/scalalib/ScalaWorkerApi.scala @@ -16,21 +16,23 @@ object ScalaWorkerModule extends mill.define.ExternalModule with ScalaWorkerModu lazy val millDiscover = Discover[this.type] } trait ScalaWorkerModule extends mill.Module{ - def scalaWorkerClasspath = T{ + def repositories = Seq(Cache.ivy2Local, MavenRepository("https://repo1.maven.org/maven2")) + + def classpath = T{ val scalaWorkerJar = sys.props("MILL_SCALA_WORKER") if (scalaWorkerJar != null) { mill.eval.Result.Success(Loose.Agg.from(scalaWorkerJar.split(',').map(Path(_)))) } else { resolveDependencies( - Seq(Cache.ivy2Local, MavenRepository("https://repo1.maven.org/maven2")), + repositories, "2.12.4", Seq(ivy"com.lihaoyi::mill-scalaworker:${sys.props("MILL_VERSION")}") ).map(_.map(_.path)) } } - def scalaWorker: Worker[ScalaWorkerApi] = T.worker{ + def worker: Worker[ScalaWorkerApi] = T.worker{ val cl = new java.net.URLClassLoader( - scalaWorkerClasspath().map(_.toNIO.toUri.toURL).toArray, + classpath().map(_.toNIO.toUri.toURL).toArray, getClass.getClassLoader ) val cls = cl.loadClass("mill.scalaworker.ScalaWorker") @@ -41,7 +43,7 @@ trait ScalaWorkerModule extends mill.Module{ def compilerInterfaceClasspath = T{ resolveDependencies( - Seq(Cache.ivy2Local, MavenRepository("https://repo1.maven.org/maven2")), + repositories, "2.12.4", Seq(ivy"org.scala-sbt:compiler-interface:1.1.0") ) |