diff options
-rw-r--r-- | core/src/main/scala/mill/eval/Evaluator.scala | 19 | ||||
-rw-r--r-- | scalaplugin/src/main/scala/mill/scalaplugin/GenIdea.scala | 15 |
2 files changed, 22 insertions, 12 deletions
diff --git a/core/src/main/scala/mill/eval/Evaluator.scala b/core/src/main/scala/mill/eval/Evaluator.scala index 8163a304..6e103ace 100644 --- a/core/src/main/scala/mill/eval/Evaluator.scala +++ b/core/src/main/scala/mill/eval/Evaluator.scala @@ -35,6 +35,16 @@ class Evaluator(workspacePath: Path, Evaluator.Results(goals.items.map(results), evaluated, transitive) } + def resolveDestPaths(t: Task[_]): Option[(Path, Path)] = { + labeling.get(t) match{ + case Some(labeling) => + val targetDestPath = workspacePath / labeling.segments + val metadataPath = targetDestPath / up / (targetDestPath.last + ".mill.json") + Some((targetDestPath, metadataPath)) + case None => None + } + } + def evaluateGroupCached(terminal: Task[_], group: OSet[Task[_]], results: collection.Map[Task[_], Any]): (collection.Map[Task[_], Any], Seq[Task[_]]) = { @@ -46,13 +56,8 @@ class Evaluator(workspacePath: Path, externalInputs.toIterator.map(results).toVector.hashCode + group.toIterator.map(_.sideHash).toVector.hashCode() - val (targetDestPath, metadataPath) = labeling.get(terminal) match{ - case Some(labeling) => - val targetDestPath = workspacePath / labeling.segments - val metadataPath = targetDestPath / up / (targetDestPath.last + ".mill.json") - (Some(targetDestPath), Some(metadataPath)) - case None => (None, None) - } + val destPaths = resolveDestPaths(terminal) + val (targetDestPath, metadataPath) = (destPaths.map(_._1), destPaths.map(_._2)) val cached = for{ metadataPath <- metadataPath diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/GenIdea.scala b/scalaplugin/src/main/scala/mill/scalaplugin/GenIdea.scala index eca36184..f55efa4d 100644 --- a/scalaplugin/src/main/scala/mill/scalaplugin/GenIdea.scala +++ b/scalaplugin/src/main/scala/mill/scalaplugin/GenIdea.scala @@ -72,12 +72,13 @@ object GenIdea { } val moduleFiles = resolved.map{ case (path, resolvedDeps, mod) => - val Seq(sourcePath: PathRef, outputPath: PathRef) = - evaluator.evaluate(OSet(mod.sources, mod.compile)).values + val Seq(sourcePath: PathRef) = + evaluator.evaluate(OSet(mod.sources)).values + val Some((destPath, jsonPath)) = evaluator.resolveDestPaths(mod.compile) val elem = moduleXmlTemplate( sourcePath.path, - outputPath.path, + Seq(destPath, jsonPath), resolvedDeps.map(pathToLibName), for(m <- mod.projectDeps) yield moduleLabels(m).mkString(".").toLowerCase @@ -138,12 +139,16 @@ object GenIdea { </component> } def moduleXmlTemplate(sourcePath: Path, - outputPath: Path, + outputPaths: Seq[Path], libNames: Seq[String], depNames: Seq[String]) = { <module type="JAVA_MODULE" version="4"> <component name="NewModuleRootManager"> - <output url={"file://$MODULE_DIR$/" + relify(outputPath)} /> + { + for(outputPath <- outputPaths) + yield <output url={"file://$MODULE_DIR$/" + relify(outputPath)} /> + } + <exclude-output /> <content url={"file://$MODULE_DIR$/" + relify(sourcePath)}> <sourceFolder url={"file://$MODULE_DIR$/" + relify(sourcePath)} isTestSource="false" /> |