diff options
Diffstat (limited to 'scalalib')
-rw-r--r-- | scalalib/src/mill/scalalib/GenIdea.scala | 32 | ||||
-rw-r--r-- | scalalib/test/src/mill/scalalib/GenIdeaTests.scala | 6 |
2 files changed, 21 insertions, 17 deletions
diff --git a/scalalib/src/mill/scalalib/GenIdea.scala b/scalalib/src/mill/scalalib/GenIdea.scala index 7fa2536d..c48e3bc8 100644 --- a/scalalib/src/mill/scalalib/GenIdea.scala +++ b/scalalib/src/mill/scalalib/GenIdea.scala @@ -28,25 +28,29 @@ object GenIdea { } } - def xmlFileLayout[T](evaluator: Evaluator[T], rootModule: mill.Module): Seq[(RelPath, scala.xml.Node)] = { + def xmlFileLayout[T](evaluator: Evaluator[T], + rootModule: mill.Module, + fetchMillModules: Boolean = true): Seq[(RelPath, scala.xml.Node)] = { val modules = rootModule.millInternal.segmentsToModules.values .collect{ case x: scalalib.ScalaModule => (x.millModuleSegments, x)} .toSeq - val buildLibraryPaths = sys.props.get("MILL_BUILD_LIBRARIES") match { - case Some(found) => Agg.from(found.split(',').map(Path(_)).distinct) - case None => - val artifactNames = Seq("moduledefs", "core", "scalalib", "scalajslib") - val Result.Success(res) = scalalib.Lib.resolveDependencies( - Seq(Cache.ivy2Local, MavenRepository("https://repo1.maven.org/maven2")), - "2.12.4", - "2.12", - for(name <- artifactNames) - yield Dep("com.lihaoyi", s"mill-${name}", "0.0.1-SNAPSHOT") - ) - res.items.toSeq.map(_.path) - } + val buildLibraryPaths = + if (!fetchMillModules) Nil + else sys.props.get("MILL_BUILD_LIBRARIES") match { + case Some(found) => Agg.from(found.split(',').map(Path(_)).distinct) + case None => + val artifactNames = Seq("moduledefs", "core", "scalalib", "scalajslib") + val Result.Success(res) = scalalib.Lib.resolveDependencies( + Seq(Cache.ivy2Local, MavenRepository("https://repo1.maven.org/maven2")), + "2.12.4", + "2.12", + for(name <- artifactNames) + yield Dep("com.lihaoyi", s"mill-${name}", "0.0.1-SNAPSHOT") + ) + res.items.toSeq.map(_.path) + } val resolved = for((path, mod) <- modules) yield { val Seq(resolvedCp: Loose.Agg[PathRef], resolvedSrcs: Loose.Agg[PathRef]) = diff --git a/scalalib/test/src/mill/scalalib/GenIdeaTests.scala b/scalalib/test/src/mill/scalalib/GenIdeaTests.scala index d49e6a1c..ae5810df 100644 --- a/scalalib/test/src/mill/scalalib/GenIdeaTests.scala +++ b/scalalib/test/src/mill/scalalib/GenIdeaTests.scala @@ -29,10 +29,10 @@ object GenIdeaTests extends TestSuite { def tests: Tests = Tests { 'genIdeaTests - { helloWorldEvaluator(HelloWorld.scalaVersion) - val x = GenIdea.xmlFileLayout(helloWorldEvaluator.evaluator, HelloWorld) val pp = new scala.xml.PrettyPrinter(999, 4) - for((relPath, xml) <- GenIdea.xmlFileLayout(helloWorldEvaluator.evaluator, HelloWorld)){ + val layout = GenIdea.xmlFileLayout(helloWorldEvaluator.evaluator, HelloWorld, fetchMillModules = false) + for((relPath, xml) <- layout){ write.over(basePath/ "generated"/ relPath, pp.format(xml)) } @@ -60,7 +60,7 @@ object GenIdeaTests extends TestSuite { "gen-idea/idea/modules.xml" -> basePath / "generated" / ".idea" / "modules.xml", "gen-idea/idea/misc.xml" -> - basePath / "generated" / ".idea" / "misc.xml", + basePath / "generated" / ".idea" / "misc.xml" ).foreach { case (resource, generated) => val resourceString = scala.io.Source.fromResource(resource).getLines().mkString("\n") val generatedString = normaliseLibraryPaths(read! generated) |