diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-25 07:39:53 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-25 07:39:53 -0800 |
commit | ac62721c10cc61d3913cf71c3ef2e9e0680ddeb9 (patch) | |
tree | 7df76fecba79ee2b7313fc01a3d562efaa92500b /scalaplugin | |
parent | 624fff48422b8c74b48c2dda86a55a82a754d5a2 (diff) | |
download | mill-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.scala | 13 | ||||
-rw-r--r-- | scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala | 17 |
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(".") } |