diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-11-05 03:00:04 +0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-11-05 21:14:58 +0800 |
commit | bc9dc386625021fec517f2dbf0644ccafe1e32c2 (patch) | |
tree | 12db6817470708c7aa274aa231ef35eb79f2123a /contrib/scalapblib/src | |
parent | 8afe79afe33be68f59f89b8410984e508c3e8d08 (diff) | |
download | mill-bc9dc386625021fec517f2dbf0644ccafe1e32c2.tar.gz mill-bc9dc386625021fec517f2dbf0644ccafe1e32c2.tar.bz2 mill-bc9dc386625021fec517f2dbf0644ccafe1e32c2.zip |
WIP migrating over from `ammonite.ops` to `os` module.
__.compile works, haven't run tests yet
Diffstat (limited to 'contrib/scalapblib/src')
-rw-r--r-- | contrib/scalapblib/src/mill/contrib/scalapblib/ScalaPBWorker.scala | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/contrib/scalapblib/src/mill/contrib/scalapblib/ScalaPBWorker.scala b/contrib/scalapblib/src/mill/contrib/scalapblib/ScalaPBWorker.scala index ea11a624..a1b345b4 100644 --- a/contrib/scalapblib/src/mill/contrib/scalapblib/ScalaPBWorker.scala +++ b/contrib/scalapblib/src/mill/contrib/scalapblib/ScalaPBWorker.scala @@ -5,15 +5,14 @@ import java.io.File import java.lang.reflect.Method import java.net.URLClassLoader -import ammonite.ops.{Path, ls} import mill.eval.PathRef class ScalaPBWorker { private var scalaPBInstanceCache = Option.empty[(Long, ScalaPBWorkerApi)] - private def scalaPB(scalaPBClasspath: Agg[Path]) = { - val classloaderSig = scalaPBClasspath.map(p => p.toString().hashCode + p.mtime.toMillis).sum + private def scalaPB(scalaPBClasspath: Agg[os.Path]) = { + val classloaderSig = scalaPBClasspath.map(p => p.toString().hashCode + os.mtime(p)).sum scalaPBInstanceCache match { case Some((sig, instance)) if sig == classloaderSig => instance case _ => @@ -40,14 +39,14 @@ class ScalaPBWorker { } } - def compile(scalaPBClasspath: Agg[Path], scalaPBSources: Seq[Path], scalaPBOptions: String, dest: Path) + def compile(scalaPBClasspath: Agg[os.Path], scalaPBSources: Seq[os.Path], scalaPBOptions: String, dest: os.Path) (implicit ctx: mill.util.Ctx): mill.eval.Result[PathRef] = { val compiler = scalaPB(scalaPBClasspath) - def compileScalaPBDir(inputDir: Path) { + def compileScalaPBDir(inputDir: os.Path) { // ls throws if the path doesn't exist if (inputDir.toIO.exists) { - ls.rec(inputDir).filter(_.name.matches(".*.proto")) + os.walk(inputDir).filter(_.last.matches(".*.proto")) .foreach { proto => compiler.compileScalaPB(proto.toIO, scalaPBOptions, dest.toIO) } |