diff options
author | Andres Pipicello <andres.pipicello@olx.com> | 2019-06-11 14:54:37 -0300 |
---|---|---|
committer | Tobias Roeser <le.petit.fou@web.de> | 2019-06-28 08:37:39 +0200 |
commit | c2c64bbbc4034fdfbd9bc4da56f25fef3cd68f63 (patch) | |
tree | e2b7ecde2e436672f8398ed6721330686ae57b7f /scalalib/test/src/GenIdeaTests.scala | |
parent | 2721b51dfad63f5798a8b22385a0cd157e33d935 (diff) | |
download | mill-c2c64bbbc4034fdfbd9bc4da56f25fef3cd68f63.tar.gz mill-c2c64bbbc4034fdfbd9bc4da56f25fef3cd68f63.tar.bz2 mill-c2c64bbbc4034fdfbd9bc4da56f25fef3cd68f63.zip |
Changed GenIdeaTests to use ScriptTestSuite
Diffstat (limited to 'scalalib/test/src/GenIdeaTests.scala')
-rw-r--r-- | scalalib/test/src/GenIdeaTests.scala | 60 |
1 files changed, 21 insertions, 39 deletions
diff --git a/scalalib/test/src/GenIdeaTests.scala b/scalalib/test/src/GenIdeaTests.scala index 60c9f9a8..efd6381c 100644 --- a/scalalib/test/src/GenIdeaTests.scala +++ b/scalalib/test/src/GenIdeaTests.scala @@ -1,50 +1,29 @@ package mill.scalalib -import mill._ -import mill.util.{TestEvaluator, TestUtil} +import mill.util.ScriptTestSuite +import os.Path import utest._ -object GenIdeaTests extends TestSuite { - - val millSourcePath = os.pwd / 'target / 'workspace / "gen-idea" - - trait HelloWorldModule extends scalalib.ScalaModule { - def scalaVersion = "2.12.4" - def millSourcePath = GenIdeaTests.millSourcePath - object test extends super.Tests { - def testFrameworks = Seq("utest.runner.Framework") - } - } - - object HelloWorld extends TestUtil.BaseModule with HelloWorldModule - - val helloWorldEvaluator = TestEvaluator.static(HelloWorld) +object GenIdeaTests extends ScriptTestSuite(false) { def tests: Tests = Tests { 'genIdeaTests - { - val pp = new scala.xml.PrettyPrinter(999, 4) - - val layout = GenIdeaImpl.xmlFileLayout( - helloWorldEvaluator.evaluator, - HelloWorld, - ("JDK_1_8", "1.8 (1)"), None, fetchMillModules = false) - for((relPath, xml) <- layout){ - os.write.over(millSourcePath/ "generated"/ relPath, pp.format(xml), createFolders = true) - } + initWorkspace() + eval("mill.scalalib.GenIdea/idea") Seq( - "gen-idea/idea_modules/iml" -> - millSourcePath / "generated" / ".idea_modules" /".iml", - "gen-idea/idea_modules/test.iml" -> - millSourcePath / "generated" / ".idea_modules" /"test.iml", - "gen-idea/idea_modules/mill-build.iml" -> - millSourcePath / "generated" / ".idea_modules" /"mill-build.iml", - "gen-idea/idea/libraries/scala-library-2.12.4.jar.xml" -> - millSourcePath / "generated" / ".idea" / "libraries" / "scala-library-2.12.4.jar.xml", - "gen-idea/idea/modules.xml" -> - millSourcePath / "generated" / ".idea" / "modules.xml", - "gen-idea/idea/misc.xml" -> - millSourcePath / "generated" / ".idea" / "misc.xml" + s"$workspaceSlug/idea_modules/helloworld.iml" -> + os.pwd / ".idea_modules" /"helloworld.iml", + s"$workspaceSlug/idea_modules/helloworld.test.iml" -> + os.pwd / ".idea_modules" /"helloworld.test.iml", +// s"$workspaceSlug/idea_modules/mill-build.iml" -> +// os.pwd / ".idea_modules" /"mill-build.iml", + s"$workspaceSlug/idea/libraries/scala-library-2.12.4.jar.xml" -> + os.pwd / ".idea" / "libraries" / "scala-library-2.12.4.jar.xml", + s"$workspaceSlug/idea/modules.xml" -> + os.pwd / ".idea" / "modules.xml", + s"$workspaceSlug/idea/misc.xml" -> + os.pwd / ".idea" / "misc.xml" ).foreach { case (resource, generated) => val resourceString = scala.io.Source.fromResource(resource).getLines().mkString("\n") val generatedString = normaliseLibraryPaths(os.read(generated)) @@ -54,8 +33,11 @@ object GenIdeaTests extends TestSuite { } } - private def normaliseLibraryPaths(in: String): String = { in.replaceAll(coursier.paths.CoursierPaths.cacheDirectory().toString, "COURSIER_HOME") } + + override def workspaceSlug: String = "gen-idea-hello-world" + + override def scriptSourcePath: Path = os.pwd / 'scalalib / 'test / 'resources / workspaceSlug } |