diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-12-04 07:52:31 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-12-04 08:48:17 -0800 |
commit | 7238d7340744a5eda74acb6970c2cbf7bedea0e7 (patch) | |
tree | a0d2e6cb108779ebb4ca63be03c03ad45e41346e /scalaplugin/src/main | |
parent | 54f2af0a974e28b81026f503eff420fad2869d2f (diff) | |
download | mill-7238d7340744a5eda74acb6970c2cbf7bedea0e7.tar.gz mill-7238d7340744a5eda74acb6970c2cbf7bedea0e7.tar.bz2 mill-7238d7340744a5eda74acb6970c2cbf7bedea0e7.zip |
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
Diffstat (limited to 'scalaplugin/src/main')
-rw-r--r-- | scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala | 14 |
1 files changed, 12 insertions, 2 deletions
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(), |