summaryrefslogtreecommitdiff
path: root/scalalib/worker/src/mill/scalalib/worker/ZincWorkerImpl.scala
diff options
context:
space:
mode:
Diffstat (limited to 'scalalib/worker/src/mill/scalalib/worker/ZincWorkerImpl.scala')
-rw-r--r--scalalib/worker/src/mill/scalalib/worker/ZincWorkerImpl.scala49
1 files changed, 24 insertions, 25 deletions
diff --git a/scalalib/worker/src/mill/scalalib/worker/ZincWorkerImpl.scala b/scalalib/worker/src/mill/scalalib/worker/ZincWorkerImpl.scala
index 78595b14..d494760e 100644
--- a/scalalib/worker/src/mill/scalalib/worker/ZincWorkerImpl.scala
+++ b/scalalib/worker/src/mill/scalalib/worker/ZincWorkerImpl.scala
@@ -3,7 +3,6 @@ package mill.scalalib.worker
import java.io.File
import java.util.Optional
-import ammonite.ops.{Path, exists, ls, mkdir}
import ammonite.util.Colors
import mill.Agg
import mill.eval.PathRef
@@ -50,9 +49,9 @@ class ZincWorkerImpl(ctx0: mill.util.Ctx,
@volatile var mixedCompilersCache = Option.empty[(Long, Compilers)]
def docJar(scalaVersion: String,
- compilerBridgeSources: Path,
- compilerClasspath: Agg[Path],
- scalacPluginClasspath: Agg[Path],
+ compilerBridgeSources: os.Path,
+ compilerClasspath: Agg[os.Path],
+ scalacPluginClasspath: Agg[os.Path],
args: Seq[String])
(implicit ctx: mill.util.Ctx): Boolean = {
val compilers: Compilers = prepareCompilers(
@@ -69,16 +68,16 @@ class ZincWorkerImpl(ctx0: mill.util.Ctx,
* TODO: Proper invalidation, see #389
*/
def compileZincBridgeIfNeeded(scalaVersion: String,
- sourcesJar: Path,
- compilerJars: Array[File]): Path = {
+ sourcesJar: os.Path,
+ compilerJars: Array[File]): os.Path = {
val workingDir = ctx0.dest / scalaVersion
val compiledDest = workingDir / 'compiled
- if (!exists(workingDir)) {
+ if (!os.exists(workingDir)) {
ctx0.log.info("Compiling compiler interface...")
- mkdir(workingDir)
- mkdir(compiledDest)
+ os.makeDir.all(workingDir)
+ os.makeDir.all(compiledDest)
val sourceFolder = mill.modules.Util.unpackZip(sourcesJar)(workingDir)
val classloader = mill.util.ClassLoader.create(compilerJars.map(_.toURI.toURL), null)(ctx0)
@@ -91,7 +90,7 @@ class ZincWorkerImpl(ctx0: mill.util.Ctx,
val argsArray = Array[String](
"-d", compiledDest.toString,
"-classpath", (compilerJars ++ compilerBridgeClasspath).mkString(File.pathSeparator)
- ) ++ ls.rec(sourceFolder.path).filter(_.ext == "scala").map(_.toString)
+ ) ++ os.walk(sourceFolder.path).filter(_.ext == "scala").map(_.toString)
compilerMain.getMethod("process", classOf[Array[String]])
.invoke(null, argsArray)
@@ -116,8 +115,8 @@ class ZincWorkerImpl(ctx0: mill.util.Ctx,
}
def compileJava(upstreamCompileOutput: Seq[CompilationResult],
- sources: Agg[Path],
- compileClasspath: Agg[Path],
+ sources: Agg[os.Path],
+ compileClasspath: Agg[os.Path],
javacOptions: Seq[String])
(implicit ctx: mill.util.Ctx): mill.eval.Result[CompilationResult] = {
compileInternal(
@@ -131,14 +130,14 @@ class ZincWorkerImpl(ctx0: mill.util.Ctx,
}
def compileMixed(upstreamCompileOutput: Seq[CompilationResult],
- sources: Agg[Path],
- compileClasspath: Agg[Path],
+ sources: Agg[os.Path],
+ compileClasspath: Agg[os.Path],
javacOptions: Seq[String],
scalaVersion: String,
scalacOptions: Seq[String],
- compilerBridgeSources: Path,
- compilerClasspath: Agg[Path],
- scalacPluginClasspath: Agg[Path])
+ compilerBridgeSources: os.Path,
+ compilerClasspath: Agg[os.Path],
+ scalacPluginClasspath: Agg[os.Path])
(implicit ctx: mill.util.Ctx): mill.eval.Result[CompilationResult] = {
val compilers: Compilers = prepareCompilers(
scalaVersion,
@@ -158,9 +157,9 @@ class ZincWorkerImpl(ctx0: mill.util.Ctx,
}
private def prepareCompilers(scalaVersion: String,
- compilerBridgeSources: Path,
- compilerClasspath: Agg[Path],
- scalacPluginClasspath: Agg[Path])
+ compilerBridgeSources: os.Path,
+ compilerClasspath: Agg[os.Path],
+ scalacPluginClasspath: Agg[os.Path])
(implicit ctx: mill.util.Ctx)= {
val combinedCompilerClasspath = compilerClasspath ++ scalacPluginClasspath
val combinedCompilerJars = combinedCompilerClasspath.toArray.map(_.toIO)
@@ -170,11 +169,11 @@ class ZincWorkerImpl(ctx0: mill.util.Ctx,
compilerBridgeSources,
compilerClasspath.toArray.map(_.toIO)
)
- val compilerBridgeSig = compilerBridge.mtime.toMillis
+ val compilerBridgeSig = os.mtime(compilerBridge)
val compilersSig =
compilerBridgeSig +
- combinedCompilerClasspath.map(p => p.toString().hashCode + p.mtime.toMillis).sum
+ combinedCompilerClasspath.map(p => p.toString().hashCode + os.mtime(p)).sum
val compilers = mixedCompilersCache match {
case Some((k, v)) if k == compilersSig => v
@@ -205,13 +204,13 @@ class ZincWorkerImpl(ctx0: mill.util.Ctx,
}
private def compileInternal(upstreamCompileOutput: Seq[CompilationResult],
- sources: Agg[Path],
- compileClasspath: Agg[Path],
+ sources: Agg[os.Path],
+ compileClasspath: Agg[os.Path],
javacOptions: Seq[String],
scalacOptions: Seq[String],
compilers: Compilers)
(implicit ctx: mill.util.Ctx): mill.eval.Result[CompilationResult] = {
- mkdir(ctx.dest)
+ os.makeDir.all(ctx.dest)
val logger = {
val consoleAppender = MainAppender.defaultScreen(ConsoleOut.printStreamOut(