diff options
Diffstat (limited to 'scalalib/src')
-rw-r--r-- | scalalib/src/main/scala/mill/scalalib/GenIdea.scala | 23 | ||||
-rw-r--r-- | scalalib/src/main/scala/mill/scalalib/Module.scala | 2 | ||||
-rw-r--r-- | scalalib/src/test/scala/mill/scalalib/HelloWorldTests.scala | 16 |
3 files changed, 18 insertions, 23 deletions
diff --git a/scalalib/src/main/scala/mill/scalalib/GenIdea.scala b/scalalib/src/main/scala/mill/scalalib/GenIdea.scala index 45067751..e4c6e701 100644 --- a/scalalib/src/main/scala/mill/scalalib/GenIdea.scala +++ b/scalalib/src/main/scala/mill/scalalib/GenIdea.scala @@ -2,37 +2,32 @@ package mill.scalalib import ammonite.ops._ import mill.define.{Segment, Segments, Target} -import mill.discover.{Discovered, Mirror} -import mill.eval.{Evaluator, PathRef} +import mill.eval.{Evaluator, PathRef, RootModuleLoader} +import mill.scalalib import mill.util.Ctx.{LoaderCtx, LogCtx} -import mill.util.{PrintLogger} +import mill.util.PrintLogger import mill.util.Strict.Agg object GenIdea { def apply()(implicit ctx: LoaderCtx with LogCtx): Unit = { - val mapping = ctx.load(mill.discover.Discovered.Mapping) + val rootModule = ctx.load(RootModuleLoader) val pp = new scala.xml.PrettyPrinter(999, 4) rm! pwd/".idea" rm! pwd/".idea_modules" - val evaluator = new Evaluator(pwd / 'out, pwd, mapping, ctx.log) + val evaluator = new Evaluator(pwd / 'out, pwd, rootModule , ctx.log) - for((relPath, xml) <- xmlFileLayout(evaluator)){ + for((relPath, xml) <- xmlFileLayout(evaluator, rootModule)){ write.over(pwd/relPath, pp.format(xml)) } } - def xmlFileLayout[T](evaluator: Evaluator[T]): Seq[(RelPath, scala.xml.Node)] = { + def xmlFileLayout[T](evaluator: Evaluator[T], rootModule: mill.Module): Seq[(RelPath, scala.xml.Node)] = { - val modules = Mirror - .traverse(evaluator.mapping.base, evaluator.mapping.mirror){ (h, p) => - h.node(evaluator.mapping.base, p.value.map{case Segment.Cross(vs) => vs.toList case _ => Nil}.toList) match { - case m: Module => Seq(p -> m) - case _ => Nil - } - } + + val modules = rootModule.modules.collect{case x: scalalib.Module => (x.ctx.segments, x)}.toSeq val resolved = for((path, mod) <- modules) yield { val Seq(resolvedCp: Seq[PathRef], resolvedSrcs: Seq[PathRef]) = diff --git a/scalalib/src/main/scala/mill/scalalib/Module.scala b/scalalib/src/main/scala/mill/scalalib/Module.scala index 3b63b280..48eb4b14 100644 --- a/scalalib/src/main/scala/mill/scalalib/Module.scala +++ b/scalalib/src/main/scala/mill/scalalib/Module.scala @@ -4,7 +4,7 @@ package scalalib import ammonite.ops._ import coursier.{Cache, MavenRepository, Repository} import mill.define.{Cross, Task} -import mill.define.Task.TaskModule +import mill.define.TaskModule import mill.eval.{PathRef, Result} import mill.modules.Jvm import mill.modules.Jvm.{createAssembly, createJar, interactiveSubprocess, subprocess} diff --git a/scalalib/src/test/scala/mill/scalalib/HelloWorldTests.scala b/scalalib/src/test/scala/mill/scalalib/HelloWorldTests.scala index ad7235d1..0f525b38 100644 --- a/scalalib/src/test/scala/mill/scalalib/HelloWorldTests.scala +++ b/scalalib/src/test/scala/mill/scalalib/HelloWorldTests.scala @@ -6,7 +6,7 @@ import ammonite.ops._ import ammonite.ops.ImplicitWd._ import mill._ import mill.define.Target -import mill.discover.Discovered + import mill.eval.{Evaluator, Result} import mill.scalalib.publish._ import mill.util.{TestEvaluator, TestUtil} @@ -35,7 +35,7 @@ object HelloWorldWithMain extends TestUtil.BaseModule with HelloWorldModule { object HelloWorldWithMainAssembly extends TestUtil.BaseModule with HelloWorldModule { def mainClass = Some("Main") def assembly = T{ - modules.Jvm.createAssembly( + mill.modules.Jvm.createAssembly( runClasspath().map(_.path).filter(exists), prependShellScript = prependShellScript(), mainClass = mainClass() @@ -85,32 +85,32 @@ object HelloWorldTests extends TestSuite { val helloWorldEvaluator = new TestEvaluator( - Discovered.mapping(HelloWorld), + HelloWorld, outPath, workingSrcPath ) val helloWorldWithMainEvaluator = new TestEvaluator( - Discovered.mapping(HelloWorldWithMain), + HelloWorldWithMain, outPath, workingSrcPath ) val helloWorldWithMainAssemblyEvaluator = new TestEvaluator( - Discovered.mapping(HelloWorldWithMainAssembly), + HelloWorldWithMainAssembly, outPath, workingSrcPath ) val helloWorldFatalEvaluator = new TestEvaluator( - Discovered.mapping(HelloWorldFatalWarnings), + HelloWorldFatalWarnings, outPath, workingSrcPath ) val helloWorldOverrideEvaluator = new TestEvaluator( - Discovered.mapping(HelloWorldScalaOverride), + HelloWorldScalaOverride, outPath, workingSrcPath ) val helloWorldCrossEvaluator = new TestEvaluator( - Discovered.mapping(CrossHelloWorld), + CrossHelloWorld, outPath, workingSrcPath ) |