From 7238d7340744a5eda74acb6970c2cbf7bedea0e7 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 4 Dec 2017 07:52:31 -0800 Subject: Cross building acyclic now works, using a locally compiled cross-versioned compiler-bridge.jar. For now just hardcode the Scala versions we want to support as part of the build; we can figure out how to do the runtime download&compile thing later --- .../src/main/scala/mill/scalaplugin/ScalaModule.scala | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'scalaplugin/src/main') diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala index 6b67b708..27aefb12 100644 --- a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala +++ b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala @@ -4,6 +4,7 @@ package scalaplugin import java.io.File import java.net.URLClassLoader import java.util.Optional +import java.util.concurrent.Callable import ammonite.ops._ import coursier.{Cache, Fetch, MavenRepository, Repository, Resolution} @@ -17,6 +18,8 @@ import sbt.internal.util.{ConsoleOut, MainAppender} import sbt.util.{InterfaceUtil, LogExchange} import xsbti.compile.{CompilerCache => _, FileAnalysisStore => _, ScalaInstance => _, _} import mill.util.JsonFormatters._ +import sbt.librarymanagement.DependencyResolution +import xsbti.GlobalLock @@ -49,7 +52,11 @@ object ScalaModule{ val outerClassLoader = getClass.getClassLoader val compilerJars = compilerClasspath.toArray.map(_.toIO) - val compilerBridgeJar = grepJar(compilerBridge, s"compiler-bridge_$binaryScalaVersion-1.0.5.jar") + + val compilerBridgeJar = new java.io.File( + s"bridge/${scalaVersion.replace('.', '_')}/target/scala-$binaryScalaVersion/mill-bridge_$scalaVersion-0.1-SNAPSHOT.jar" + ) + val zincClassLoader = new URLClassLoader(compilerJars.map(_.toURI.toURL), null){ override def loadClass(name: String): Class[_] = { Option(findLoadedClass(name)) orElse @@ -115,7 +122,8 @@ object ScalaModule{ lookup, skip = false, zincFile, - compilerCache, + new FreshCompilerCache, +// compilerCache, IncOptions.of(), reporter, Some(ignoreProgress), @@ -129,6 +137,8 @@ object ScalaModule{ logger = logger ) + zincClassLoader.close() + store.set( AnalysisContents.create( newResult.analysis(), -- cgit v1.2.3