From bc9dc386625021fec517f2dbf0644ccafe1e32c2 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 5 Nov 2018 03:00:04 +0800 Subject: WIP migrating over from `ammonite.ops` to `os` module. __.compile works, haven't run tests yet --- .../src/mill/contrib/scalapblib/TutorialTests.scala | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'contrib/scalapblib/test') diff --git a/contrib/scalapblib/test/src/mill/contrib/scalapblib/TutorialTests.scala b/contrib/scalapblib/test/src/mill/contrib/scalapblib/TutorialTests.scala index 8542d60e..65558f72 100644 --- a/contrib/scalapblib/test/src/mill/contrib/scalapblib/TutorialTests.scala +++ b/contrib/scalapblib/test/src/mill/contrib/scalapblib/TutorialTests.scala @@ -1,6 +1,5 @@ package mill.contrib.scalapblib -import ammonite.ops.{Path, cp, ls, mkdir, pwd, rm, _} import mill.eval.Result import mill.util.{TestEvaluator, TestUtil} import utest.framework.TestPath @@ -9,7 +8,7 @@ import utest.{TestSuite, Tests, assert, _} object TutorialTests extends TestSuite { trait TutorialBase extends TestUtil.BaseModule { - override def millSourcePath: Path = TestUtil.getSrcPathBase() / millOuterCtx.enclosing.split('.') + override def millSourcePath: os.Path = TestUtil.getSrcPathBase() / millOuterCtx.enclosing.split('.') } trait TutorialModule extends ScalaPBModule { @@ -25,24 +24,24 @@ object TutorialTests extends TestSuite { } } - val resourcePath: Path = pwd / 'contrib / 'scalapblib / 'test / 'protobuf / 'tutorial + val resourcePath: os.Path = os.pwd / 'contrib / 'scalapblib / 'test / 'protobuf / 'tutorial - def protobufOutPath(eval: TestEvaluator): Path = + def protobufOutPath(eval: TestEvaluator): os.Path = eval.outPath / 'core / 'compileScalaPB / 'dest / 'com / 'example / 'tutorial def workspaceTest[T](m: TestUtil.BaseModule)(t: TestEvaluator => T) (implicit tp: TestPath): T = { val eval = new TestEvaluator(m) - rm(m.millSourcePath) + os.remove.all(m.millSourcePath) println(m.millSourcePath) - rm(eval.outPath) + os.remove.all(eval.outPath) println(eval.outPath) - mkdir(m.millSourcePath / 'core / 'protobuf) - cp(resourcePath, m.millSourcePath / 'core / 'protobuf / 'tutorial) + os.makeDir.all(m.millSourcePath / 'core / 'protobuf) + os.copy(resourcePath, m.millSourcePath / 'core / 'protobuf / 'tutorial) t(eval) } - def compiledSourcefiles: Seq[RelPath] = Seq[RelPath]( + def compiledSourcefiles: Seq[os.RelPath] = Seq[os.RelPath]( "AddressBook.scala", "Person.scala", "TutorialProto.scala" @@ -67,7 +66,7 @@ object TutorialTests extends TestSuite { val outPath = protobufOutPath(eval) - val outputFiles = ls.rec(result.path).filter(_.isFile) + val outputFiles = os.walk(result.path).filter(os.isFile) val expectedSourcefiles = compiledSourcefiles.map(outPath / _) @@ -92,7 +91,7 @@ object TutorialTests extends TestSuite { // val outPath = protobufOutPath(eval) - // val outputFiles = ls.rec(outPath).filter(_.isFile) + // val outputFiles = os.walk(outPath).filter(_.isFile) // val expectedSourcefiles = compiledSourcefiles.map(outPath / _) -- cgit v1.2.3