summaryrefslogtreecommitdiff
path: root/scalalib
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-01-28 00:07:12 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-01-28 00:07:12 -0800
commit60f0a0ae5098b28999c279f0cdb105921b2c113a (patch)
treed62d83e8c2045521bb70560b65b3e34bd8ec383a /scalalib
parent02ebf026df6e08e9de8bef6dfec03d14ea46dfa1 (diff)
downloadmill-60f0a0ae5098b28999c279f0cdb105921b2c113a.tar.gz
mill-60f0a0ae5098b28999c279f0cdb105921b2c113a.tar.bz2
mill-60f0a0ae5098b28999c279f0cdb105921b2c113a.zip
Fix gen idea tests
Diffstat (limited to 'scalalib')
-rw-r--r--scalalib/src/mill/scalalib/GenIdea.scala32
-rw-r--r--scalalib/test/src/mill/scalalib/GenIdeaTests.scala6
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)