diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-25 08:01:24 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-25 08:01:24 -0800 |
commit | c3f2dc919cff83f105a60061456090f0c907f0b1 (patch) | |
tree | 83cfa7e36649eddfe2e2e797f3baaaa782507a49 /scalaplugin | |
parent | ac62721c10cc61d3913cf71c3ef2e9e0680ddeb9 (diff) | |
download | mill-c3f2dc919cff83f105a60061456090f0c907f0b1.tar.gz mill-c3f2dc919cff83f105a60061456090f0c907f0b1.tar.bz2 mill-c3f2dc919cff83f105a60061456090f0c907f0b1.zip |
First pass at simplifying test suite definition & running
Added a `TaskModule` subclass of `Module`, which delegates to a `self` task that you can run directly from bash
Fixed `GenIdea` to fix reversing of module path in generating module name
Diffstat (limited to 'scalaplugin')
-rw-r--r-- | scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala index d2c37782..5a1f261a 100644 --- a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala +++ b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala @@ -7,7 +7,7 @@ import java.util.Optional import ammonite.ops._ import coursier.{Cache, Fetch, MavenRepository, Repository, Resolution} import mill.define.Task -import mill.define.Task.Module +import mill.define.Task.{Module, TaskModule} import mill.eval.{Evaluator, PathRef} import mill.modules.Jvm.{createAssembly, createJar} import mill.util.OSet @@ -161,7 +161,7 @@ object ScalaModule{ ) } import ScalaModule._ -trait TestScalaModule extends ScalaModule{ +trait TestScalaModule extends ScalaModule with TaskModule{ def testFramework: T[String] def run() = T.command{ TestRunner( @@ -170,6 +170,7 @@ trait TestScalaModule extends ScalaModule{ Seq(compile().path) ) } + def self() = run() } trait ScalaModule extends Module{ outer => trait Tests extends TestScalaModule{ @@ -267,6 +268,8 @@ trait ScalaModule extends Module{ outer => PathRef(dest) } + + def run(mainClass: String) = T.command{ import ammonite.ops._, ImplicitWd._ %('java, "-cp", (runDepClasspath().map(_.path) :+ compile().path).mkString(":"), mainClass) |