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/buildinfo | |
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/buildinfo')
-rw-r--r-- | contrib/buildinfo/src/mill/contrib/BuildInfo.scala | 3 | ||||
-rw-r--r-- | contrib/buildinfo/test/src/mill/contrib/BuildInfoTests.scala | 27 |
2 files changed, 14 insertions, 16 deletions
diff --git a/contrib/buildinfo/src/mill/contrib/BuildInfo.scala b/contrib/buildinfo/src/mill/contrib/BuildInfo.scala index 0eb94a6d..9202fd95 100644 --- a/contrib/buildinfo/src/mill/contrib/BuildInfo.scala +++ b/contrib/buildinfo/src/mill/contrib/BuildInfo.scala @@ -1,6 +1,5 @@ package mill.contrib -import ammonite.ops.write import mill.T import mill.define.Target import mill.eval.PathRef @@ -26,7 +25,7 @@ trait BuildInfo extends ScalaModule { case (name, value) => s""" def ${name} = "${value}"""" } .mkString("\n") - write(outputFile, + os.write(outputFile, s"""|${buildInfoPackageName.map(p => s"package ${p}").getOrElse("")} |object ${buildInfoObjectName} { |$internalMembers diff --git a/contrib/buildinfo/test/src/mill/contrib/BuildInfoTests.scala b/contrib/buildinfo/test/src/mill/contrib/BuildInfoTests.scala index e2147bac..05070985 100644 --- a/contrib/buildinfo/test/src/mill/contrib/BuildInfoTests.scala +++ b/contrib/buildinfo/test/src/mill/contrib/BuildInfoTests.scala @@ -1,6 +1,5 @@ package mill.contrib -import ammonite.ops._ import java.util.jar.JarFile import mill._ import mill.define.Target @@ -43,16 +42,16 @@ object BuildInfoTests extends TestSuite { } } - val resourcePath = pwd / 'contrib / 'buildinfo / 'test / 'resources / "buildinfo" + val resourcePath = os.pwd / 'contrib / 'buildinfo / 'test / 'resources / "buildinfo" - def workspaceTest[T](m: TestUtil.BaseModule, resourcePath: Path = resourcePath) + def workspaceTest[T](m: TestUtil.BaseModule, resourcePath: os.Path = resourcePath) (t: TestEvaluator => T) (implicit tp: TestPath): T = { val eval = new TestEvaluator(m) - rm(m.millSourcePath) - rm(eval.outPath) - mkdir(m.millSourcePath / up) - cp(resourcePath, m.millSourcePath) + os.remove.all(m.millSourcePath) + os.remove.all(eval.outPath) + os.makeDir.all(m.millSourcePath / os.up) + os.copy(resourcePath, m.millSourcePath) t(eval) } @@ -68,8 +67,8 @@ object BuildInfoTests extends TestSuite { val Right((result, evalCount)) = eval.apply(BuildInfo.buildInfo) assert( result.head.path == eval.outPath / 'buildInfo / 'dest / "BuildInfo.scala" && - exists(result.head.path) && - read! result.head.path == expected + os.exists(result.head.path) && + os.read(result.head.path) == expected ) } @@ -77,7 +76,7 @@ object BuildInfoTests extends TestSuite { val Right((result, evalCount)) = eval.apply(EmptyBuildInfo.buildInfo) assert( result.isEmpty && - !exists(eval.outPath / 'buildInfo / 'dest / "BuildInfo.scala") + !os.exists(eval.outPath / 'buildInfo / 'dest / "BuildInfo.scala") ) } @@ -90,8 +89,8 @@ object BuildInfoTests extends TestSuite { val Right((result, evalCount)) = eval.apply(BuildInfoSettings.buildInfo) assert( result.head.path == eval.outPath / 'buildInfo / 'dest / "BuildInfo.scala" && - exists(result.head.path) && - read! result.head.path == expected + os.exists(result.head.path) && + os.read(result.head.path) == expected ) } @@ -104,8 +103,8 @@ object BuildInfoTests extends TestSuite { val runResult = eval.outPath / "hello-mill" val Right((result, evalCount)) = eval.apply(BuildInfo.run(runResult.toString)) assert( - exists(runResult), - read(runResult) == scalaVersionString) + os.exists(runResult), + os.read(runResult) == scalaVersionString) } } } |