summaryrefslogtreecommitdiff
path: root/scalaplugin
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2017-11-25 19:32:52 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2017-11-25 19:32:52 -0800
commitc7102daadc19a7f763b21d5bb16de7a07932168a (patch)
tree434d017643bbdc59caa5839df1ccc0a8d970d1af /scalaplugin
parent30f2d8a42c0f292f2a2ef3f0288f1297fb59af39 (diff)
downloadmill-c7102daadc19a7f763b21d5bb16de7a07932168a.tar.gz
mill-c7102daadc19a7f763b21d5bb16de7a07932168a.tar.bz2
mill-c7102daadc19a7f763b21d5bb16de7a07932168a.zip
Remove `TaskModule`, make default-task selection to be by-name (tentatively hardcoded to `run`) so we can pass CLI arguments to the default run tasks
Forward CLI arguments to the `TestModule#run` command; you can now select what tests you want to run using uTest, via: ``` mill run Core.test mill.define.ApplicativeTests ```
Diffstat (limited to 'scalaplugin')
-rw-r--r--scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala17
-rw-r--r--scalaplugin/src/main/scala/mill/scalaplugin/TestRunner.scala5
2 files changed, 8 insertions, 14 deletions
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
index 2e842a6e..70bb1a35 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, TaskModule}
+import mill.define.Task.Module
import mill.eval.{Evaluator, PathRef}
import mill.modules.Jvm.{createAssembly, createJar}
import mill.util.OSet
@@ -166,16 +166,16 @@ object ScalaModule{
)
}
import ScalaModule._
-trait TestScalaModule extends ScalaModule with TaskModule{
+trait TestScalaModule extends ScalaModule {
def testFramework: T[String]
- def run() = T.command{
+ def run(args: String*) = T.command{
TestRunner(
testFramework(),
runDepClasspath().map(_.path) :+ compile().path,
- Seq(compile().path)
+ Seq(compile().path),
+ args
)
}
- def self() = run()
}
trait ScalaModule extends Module{ outer =>
trait Tests extends TestScalaModule{
@@ -276,13 +276,6 @@ 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,
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/TestRunner.scala b/scalaplugin/src/main/scala/mill/scalaplugin/TestRunner.scala
index d8577f9c..2d0495e4 100644
--- a/scalaplugin/src/main/scala/mill/scalaplugin/TestRunner.scala
+++ b/scalaplugin/src/main/scala/mill/scalaplugin/TestRunner.scala
@@ -40,7 +40,8 @@ object TestRunner {
def apply(frameworkName: String,
entireClasspath: Seq[Path],
- testClassfilePath: Seq[Path]): mill.eval.Result[Unit] = {
+ testClassfilePath: Seq[Path],
+ args: Seq[String]): mill.eval.Result[Unit] = {
val outerClassLoader = getClass.getClassLoader
val cl = new URLClassLoader(entireClasspath.map(_.toIO.toURI.toURL).toArray){
override def findClass(name: String) = {
@@ -58,7 +59,7 @@ object TestRunner {
val testClasses = runTests(cl, framework, testClassfilePath)
- val runner = framework.runner(Array(), Array(), cl)
+ val runner = framework.runner(args.toArray, args.toArray, cl)
val tasks = runner.tasks(
for((cls, fingerprint) <- testClasses.toArray)