diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-12-04 21:55:01 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-12-04 21:55:15 -0800 |
commit | 422d41498d43ad9b437b2d4460f61849e78bb6fa (patch) | |
tree | 167ebadc8dab617bbc6388d1ff4d13b5b08115d1 /core/src/test | |
parent | e9f3c71f670f93c95f0ae47860e663b768885067 (diff) | |
download | mill-422d41498d43ad9b437b2d4460f61849e78bb6fa.tar.gz mill-422d41498d43ad9b437b2d4460f61849e78bb6fa.tar.bz2 mill-422d41498d43ad9b437b2d4460f61849e78bb6fa.zip |
- Make `T.ctx()` available implicitly
- Convert `ScalaModule.{compile,assembly}` to use the new implicit `T.ctx()`
- Add a `log: PrintStream` to the `T.ctx()`, in preparation for per-task logging
Diffstat (limited to 'core/src/test')
-rw-r--r-- | core/src/test/examples/javac/build.sc | 4 | ||||
-rw-r--r-- | core/src/test/scala/mill/define/ApplicativeTests.scala | 5 | ||||
-rw-r--r-- | core/src/test/scala/mill/util/TestUtil.scala | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/core/src/test/examples/javac/build.sc b/core/src/test/examples/javac/build.sc index a54e2110..e4f7ea01 100644 --- a/core/src/test/examples/javac/build.sc +++ b/core/src/test/examples/javac/build.sc @@ -8,7 +8,7 @@ object Foo { import ammonite.ops.{ls, pwd, read} import mill.discover.Discovered - import mill.util.Args + import mill.util.Ctx val workspacePath = pwd / 'target / 'workspace / 'javac val javacSrcPath = pwd / 'src / 'test / 'examples / 'javac @@ -45,7 +45,7 @@ object Foo { val inputs = roots - def evaluate(args: Args): PathRef = { + def evaluate(args: Ctx): PathRef = { val output = new java.util.jar.JarOutputStream(new FileOutputStream(args.dest.toIO)) for { diff --git a/core/src/test/scala/mill/define/ApplicativeTests.scala b/core/src/test/scala/mill/define/ApplicativeTests.scala index 7e31b08e..7e325184 100644 --- a/core/src/test/scala/mill/define/ApplicativeTests.scala +++ b/core/src/test/scala/mill/define/ApplicativeTests.scala @@ -1,7 +1,9 @@ package mill.define +import mill.define.Applicative.ImplicitStub import utest._ +import scala.annotation.compileTimeOnly import scala.language.experimental.macros @@ -44,6 +46,9 @@ object ApplicativeTests extends TestSuite { value } } + @compileTimeOnly("Target.ctx() can only be used with a T{...} block") + @ImplicitStub + implicit def taskCtx: String = ??? val tests = Tests{ diff --git a/core/src/test/scala/mill/util/TestUtil.scala b/core/src/test/scala/mill/util/TestUtil.scala index be6bb8e9..a456b22b 100644 --- a/core/src/test/scala/mill/util/TestUtil.scala +++ b/core/src/test/scala/mill/util/TestUtil.scala @@ -21,7 +21,7 @@ object TestUtil { var counter = 0 var failure = Option.empty[String] var exception = Option.empty[Throwable] - override def evaluate(args: Args) = { + override def evaluate(args: Ctx) = { failure.map(Result.Failure) orElse exception.map(Result.Exception) getOrElse Result.Success(counter + args.args.map(_.asInstanceOf[Int]).sum) |