diff options
Diffstat (limited to 'main/src/mill/main')
-rw-r--r-- | main/src/mill/main/MainModule.scala | 7 | ||||
-rw-r--r-- | main/src/mill/main/MainRunner.scala | 9 | ||||
-rw-r--r-- | main/src/mill/main/ReplApplyHandler.scala | 3 | ||||
-rw-r--r-- | main/src/mill/main/RunScript.scala | 19 | ||||
-rw-r--r-- | main/src/mill/main/VisualizeModule.scala | 5 |
5 files changed, 19 insertions, 24 deletions
diff --git a/main/src/mill/main/MainModule.scala b/main/src/mill/main/MainModule.scala index 929ad3dc..a740a2e6 100644 --- a/main/src/mill/main/MainModule.scala +++ b/main/src/mill/main/MainModule.scala @@ -2,7 +2,6 @@ package mill.main import java.util.concurrent.LinkedBlockingQueue -import ammonite.ops.Path import mill.T import mill.define.{NamedTask, Task} import mill.eval.{Evaluator, PathRef, Result} @@ -200,7 +199,7 @@ trait MainModule extends mill.Module{ val KeepPattern = "(mill-.+)".r.anchored - def keepPath(path: Path) = path.segments.lastOption match { + def keepPath(path: os.Path) = path.segments.toSeq.lastOption match { case Some(KeepPattern(_)) => true case _ => false } @@ -220,7 +219,7 @@ trait MainModule extends mill.Module{ case Left(err) => Result.Failure(err) case Right(paths) => - paths.foreach(ammonite.ops.rm) + paths.foreach(os.remove.all) Result.Success(()) } } @@ -245,7 +244,7 @@ trait MainModule extends mill.Module{ } } - private type VizWorker = (LinkedBlockingQueue[(scala.Seq[_], scala.Seq[_], Path)], + private type VizWorker = (LinkedBlockingQueue[(scala.Seq[_], scala.Seq[_], os.Path)], LinkedBlockingQueue[Result[scala.Seq[PathRef]]]) private def visualize0(evaluator: Evaluator, targets: Seq[String], ctx: Ctx, vizWorker: VizWorker, diff --git a/main/src/mill/main/MainRunner.scala b/main/src/mill/main/MainRunner.scala index 4f31a724..e50ed370 100644 --- a/main/src/mill/main/MainRunner.scala +++ b/main/src/mill/main/MainRunner.scala @@ -3,7 +3,6 @@ import java.io.{InputStream, PrintStream} import ammonite.Main import ammonite.interp.{Interpreter, Preprocessor} -import ammonite.ops.Path import ammonite.util.Util.CodeSource import ammonite.util._ import mill.eval.{Evaluator, PathRef} @@ -33,7 +32,7 @@ class MainRunner(val config: ammonite.main.Cli.Config, var stateCache = stateCache0 - override def watchAndWait(watched: Seq[(Path, Long)]) = { + override def watchAndWait(watched: Seq[(os.Path, Long)]) = { printInfo(s"Watching for changes to ${watched.length} files... (Ctrl-C to exit)") def statAll() = watched.forall{ case (file, lastMTime) => Interpreter.pathSignature(file) == lastMTime @@ -50,7 +49,7 @@ class MainRunner(val config: ammonite.main.Cli.Config, */ @tailrec final def watchLoop2[T](isRepl: Boolean, printing: Boolean, - run: Main => (Res[T], () => Seq[(Path, Long)])): Boolean = { + run: Main => (Res[T], () => Seq[(os.Path, Long)])): Boolean = { val (result, watched) = run(initMain(isRepl)) val success = handleWatchRes(result, printing) @@ -62,7 +61,7 @@ class MainRunner(val config: ammonite.main.Cli.Config, } - override def runScript(scriptPath: Path, scriptArgs: List[String]) = + override def runScript(scriptPath: os.Path, scriptArgs: List[String]) = watchLoop2( isRepl = false, printing = true, @@ -146,7 +145,7 @@ class MainRunner(val config: ammonite.main.Cli.Config, |$imports |import mill._ |object $wrapName - |extends mill.define.BaseModule(ammonite.ops.Path($literalPath), foreign0 = $external)( + |extends mill.define.BaseModule(os.Path($literalPath), foreign0 = $external)( | implicitly, implicitly, implicitly, implicitly, mill.define.Caller(()) |) |with $wrapName{ diff --git a/main/src/mill/main/ReplApplyHandler.scala b/main/src/mill/main/ReplApplyHandler.scala index af69c761..a8e467d4 100644 --- a/main/src/mill/main/ReplApplyHandler.scala +++ b/main/src/mill/main/ReplApplyHandler.scala @@ -1,7 +1,6 @@ package mill.main -import ammonite.ops.Path import mill.define.Applicative.ApplyHandler import mill.define.Segment.Label import mill.define._ @@ -11,7 +10,7 @@ import mill.util.Strict.Agg import scala.collection.mutable object ReplApplyHandler{ - def apply[T](home: Path, + def apply[T](home: os.Path, disableTicker: Boolean, colors: ammonite.util.Colors, pprinter0: pprint.PPrinter, diff --git a/main/src/mill/main/RunScript.scala b/main/src/mill/main/RunScript.scala index 1c8503fe..820b1341 100644 --- a/main/src/mill/main/RunScript.scala +++ b/main/src/mill/main/RunScript.scala @@ -3,7 +3,6 @@ package mill.main import java.nio.file.NoSuchFileException import ammonite.interp.Interpreter -import ammonite.ops.{Path, read} import ammonite.runtime.SpecialClassLoader import ammonite.util.Util.CodeSource import ammonite.util.{Name, Res, Util} @@ -23,15 +22,15 @@ import scala.reflect.ClassTag * subsystem */ object RunScript{ - def runScript(home: Path, - wd: Path, - path: Path, - instantiateInterpreter: => Either[(Res.Failing, Seq[(Path, Long)]), ammonite.interp.Interpreter], + def runScript(home: os.Path, + wd: os.Path, + path: os.Path, + instantiateInterpreter: => Either[(Res.Failing, Seq[(os.Path, Long)]), ammonite.interp.Interpreter], scriptArgs: Seq[String], stateCache: Option[Evaluator.State], log: Logger, env : Map[String, String]) - : (Res[(Evaluator, Seq[PathRef], Either[String, Seq[Js.Value]])], Seq[(Path, Long)]) = { + : (Res[(Evaluator, Seq[PathRef], Either[String, Seq[Js.Value]])], Seq[(os.Path, Long)]) = { val (evalState, interpWatched) = stateCache match{ case Some(s) if watchedSigUnchanged(s.watched) => Res.Success(s) -> s.watched @@ -66,12 +65,12 @@ object RunScript{ (evaluated, interpWatched) } - def watchedSigUnchanged(sig: Seq[(Path, Long)]) = { + def watchedSigUnchanged(sig: Seq[(os.Path, Long)]) = { sig.forall{case (p, l) => Interpreter.pathSignature(p) == l} } - def evaluateRootModule(wd: Path, - path: Path, + def evaluateRootModule(wd: os.Path, + path: os.Path, interp: ammonite.interp.Interpreter, log: Logger ): Res[mill.define.BaseModule] = { @@ -80,7 +79,7 @@ object RunScript{ for { scriptTxt <- - try Res.Success(Util.normalizeNewlines(read(path))) + try Res.Success(Util.normalizeNewlines(os.read(path))) catch { case _: NoSuchFileException => log.info("No build file found, you should create build.sc to do something useful") Res.Success("") diff --git a/main/src/mill/main/VisualizeModule.scala b/main/src/mill/main/VisualizeModule.scala index ea4d46c6..71b9fc22 100644 --- a/main/src/mill/main/VisualizeModule.scala +++ b/main/src/mill/main/VisualizeModule.scala @@ -2,7 +2,6 @@ package mill.main import java.util.concurrent.LinkedBlockingQueue -import ammonite.ops.Path import coursier.Cache import coursier.core.Repository import coursier.maven.MavenRepository @@ -35,7 +34,7 @@ trait VisualizeModule extends mill.define.TaskModule{ * can communicate via in/out queues. */ def worker = T.worker{ - val in = new LinkedBlockingQueue[(Seq[_], Seq[_], Path)]() + val in = new LinkedBlockingQueue[(Seq[_], Seq[_], os.Path)]() val out = new LinkedBlockingQueue[Result[Seq[PathRef]]]() val cl = mill.util.ClassLoader.create( @@ -47,7 +46,7 @@ trait VisualizeModule extends mill.define.TaskModule{ val res = Result.create{ val (targets, tasks, dest) = in.take() cl.loadClass("mill.main.graphviz.GraphvizTools") - .getMethod("apply", classOf[Seq[_]], classOf[Seq[_]], classOf[Path]) + .getMethod("apply", classOf[Seq[_]], classOf[Seq[_]], classOf[os.Path]) .invoke(null, targets, tasks, dest) .asInstanceOf[Seq[PathRef]] } |