diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-26 07:15:08 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-26 07:15:08 -0800 |
commit | 302008684d51e49f0ce70516f283f15d41ea3831 (patch) | |
tree | ade589eba2b10a08fff7eb057c6392d6b631232d /scalaplugin | |
parent | 5557966d2e96c1711978a8b1606bd6c20d26030c (diff) | |
download | mill-302008684d51e49f0ce70516f283f15d41ea3831.tar.gz mill-302008684d51e49f0ce70516f283f15d41ea3831.tar.bz2 mill-302008684d51e49f0ce70516f283f15d41ea3831.zip |
bring back ScalaModule#run, bring back TaskModule now with a new defaultCommandName member
Diffstat (limited to 'scalaplugin')
-rw-r--r-- | scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala index 70bb1a35..a9c136d6 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 @@ -166,9 +166,10 @@ object ScalaModule{ ) } import ScalaModule._ -trait TestScalaModule extends ScalaModule { +trait TestScalaModule extends ScalaModule with TaskModule { + override def defaultCommandName() = "test" def testFramework: T[String] - def run(args: String*) = T.command{ + def test(args: String*) = T.command{ TestRunner( testFramework(), runDepClasspath().map(_.path) :+ compile().path, @@ -177,7 +178,8 @@ trait TestScalaModule extends ScalaModule { ) } } -trait ScalaModule extends Module{ outer => +trait ScalaModule extends Module with TaskModule{ outer => + def defaultCommandName() = "run" trait Tests extends TestScalaModule{ def scalaVersion = outer.scalaVersion() override def projectDeps = Seq(outer) @@ -276,6 +278,11 @@ 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) + } + def console() = T.command{ import ammonite.ops._, ImplicitWd._ %('java, |