summaryrefslogtreecommitdiff
path: root/scalaplugin
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2017-11-25 07:39:53 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2017-11-25 07:39:53 -0800
commitac62721c10cc61d3913cf71c3ef2e9e0680ddeb9 (patch)
tree7df76fecba79ee2b7313fc01a3d562efaa92500b /scalaplugin
parent624fff48422b8c74b48c2dda86a55a82a754d5a2 (diff)
downloadmill-ac62721c10cc61d3913cf71c3ef2e9e0680ddeb9.tar.gz
mill-ac62721c10cc61d3913cf71c3ef2e9e0680ddeb9.tar.bz2
mill-ac62721c10cc61d3913cf71c3ef2e9e0680ddeb9.zip
First pass at simplifying test suite definition & running
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/GenIdea.scala13
-rw-r--r--scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala17
2 files changed, 23 insertions, 7 deletions
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/GenIdea.scala b/scalaplugin/src/main/scala/mill/scalaplugin/GenIdea.scala
index 02dbbc91..7bfe14e1 100644
--- a/scalaplugin/src/main/scala/mill/scalaplugin/GenIdea.scala
+++ b/scalaplugin/src/main/scala/mill/scalaplugin/GenIdea.scala
@@ -24,12 +24,15 @@ object GenIdea {
val workspacePath = pwd / 'out
val evaluator = new Evaluator(workspacePath, mapping, _ => ())
- val modules = Mirror.traverse(obj, discovered.mirror){ (h, p) =>
- h.node(obj, p.map{case Mirror.Segment.Cross(vs) => vs case _ => Nil}.toList) match {
- case m: ScalaModule => Seq(p -> m)
- case _ => Nil
+ val modules = Mirror
+ .traverse(obj, discovered.mirror){ (h, p) =>
+ h.node(obj, p.map{case Mirror.Segment.Cross(vs) => vs case _ => Nil}.toList) match {
+ case m: ScalaModule => Seq(p -> m)
+ case _ => Nil
+ }
}
- }
+ .map{case (p, v) => (p.reverse, v)}
+
val resolved = for((path, mod) <- modules) yield {
val Seq(resolvedCp: Seq[PathRef], resolvedSrcs: Seq[PathRef]) =
evaluator.evaluate(OSet(mod.externalCompileDepClasspath, mod.externalCompileDepSources))
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
index e1b3c130..d2c37782 100644
--- a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
+++ b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
@@ -161,8 +161,21 @@ object ScalaModule{
)
}
import ScalaModule._
-
-trait ScalaModule extends Module{
+trait TestScalaModule extends ScalaModule{
+ def testFramework: T[String]
+ def run() = T.command{
+ TestRunner(
+ testFramework(),
+ runDepClasspath().map(_.path) :+ compile().path,
+ Seq(compile().path)
+ )
+ }
+}
+trait ScalaModule extends Module{ outer =>
+ trait Tests extends TestScalaModule{
+ def scalaVersion = outer.scalaVersion()
+ override def projectDeps = Seq(outer)
+ }
def scalaVersion: T[String]
def scalaBinaryVersion = T{ scalaVersion().split('.').dropRight(1).mkString(".") }