diff --git a/scalalib/src/mill/scalalib/GenIdeaImpl.scala b/scalalib/src/mill/scalalib/GenIdeaImpl.scala index 760f283548e..7ab6ffb7945 100644 --- a/scalalib/src/mill/scalalib/GenIdeaImpl.scala +++ b/scalalib/src/mill/scalalib/GenIdeaImpl.scala @@ -214,8 +214,10 @@ object GenIdeaImpl { mod.generatedSources.ctx.segments ) + val isTest = mod.isInstanceOf[TestModule] + val elem = moduleXmlTemplate( - mod.millModuleBasePath.value, + mod.intellijModulePath, scalaVersionOpt, Strict.Agg.from(resourcesPathRefs.map(_.path)), Strict.Agg.from(normalSourcePaths), @@ -223,7 +225,8 @@ object GenIdeaImpl { paths.out, generatedSourceOutPath.dest, Strict.Agg.from(resolvedDeps.map(pathToLibName)), - Strict.Agg.from(mod.moduleDeps.map{ m => moduleName(moduleLabels(m))}.distinct) + Strict.Agg.from(mod.moduleDeps.map{ m => moduleName(moduleLabels(m))}.distinct), + isTest ) Tuple2(".idea_modules"/s"${moduleName(path)}.iml", elem) } @@ -321,7 +324,9 @@ object GenIdeaImpl { compileOutputPath: Path, generatedSourceOutputPath: Path, libNames: Strict.Agg[String], - depNames: Strict.Agg[String]) = { + depNames: Strict.Agg[String], + isTest: Boolean + ) = { @@ -331,17 +336,17 @@ object GenIdeaImpl { { for (normalSourcePath <- normalSourcePaths.toSeq.sorted) yield - + } { for (generatedSourcePath <- generatedSourcePaths.toSeq.sorted) yield - + } { for (resourcePath <- resourcePaths.toSeq.sorted) yield - + } diff --git a/scalalib/src/mill/scalalib/JavaModule.scala b/scalalib/src/mill/scalalib/JavaModule.scala index 4b90331c946..740bca2b240 100644 --- a/scalalib/src/mill/scalalib/JavaModule.scala +++ b/scalalib/src/mill/scalalib/JavaModule.scala @@ -289,6 +289,8 @@ trait JavaModule extends mill.Module with TaskModule { outer => def artifactName: T[String] = millModuleSegments.parts.mkString("-") def artifactId: T[String] = artifactName() + + def intellijModulePath: Path = millSourcePath } trait TestModule extends JavaModule with TaskModule { diff --git a/scalalib/src/mill/scalalib/MiscModule.scala b/scalalib/src/mill/scalalib/MiscModule.scala index 0e8bde3e638..02a6ebf926e 100644 --- a/scalalib/src/mill/scalalib/MiscModule.scala +++ b/scalalib/src/mill/scalalib/MiscModule.scala @@ -66,12 +66,14 @@ trait MavenModule extends JavaModule{outer => override def resources = T.sources{ millSourcePath / 'src / 'main / 'resources } trait Tests extends super.Tests with MavenTests { override def millSourcePath = outer.millSourcePath + override def intellijModulePath = outer.millSourcePath / 'src / 'test } } trait SbtModule extends MavenModule with ScalaModule{ outer => trait Tests extends super.Tests with MavenTests { override def millSourcePath = outer.millSourcePath + override def intellijModulePath = outer.millSourcePath / 'src / 'test } } diff --git a/scalalib/test/resources/gen-idea/idea/modules.xml b/scalalib/test/resources/gen-idea/idea/modules.xml index d7cfbd0866c..d6334ea357d 100644 --- a/scalalib/test/resources/gen-idea/idea/modules.xml +++ b/scalalib/test/resources/gen-idea/idea/modules.xml @@ -3,6 +3,7 @@ + - \ No newline at end of file + diff --git a/scalalib/test/resources/gen-idea/idea_modules/test.iml b/scalalib/test/resources/gen-idea/idea_modules/test.iml new file mode 100644 index 00000000000..f67445ae893 --- /dev/null +++ b/scalalib/test/resources/gen-idea/idea_modules/test.iml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/scalalib/test/src/mill/scalalib/GenIdeaTests.scala b/scalalib/test/src/mill/scalalib/GenIdeaTests.scala index dc8faaf4d8d..b21c070c7a2 100644 --- a/scalalib/test/src/mill/scalalib/GenIdeaTests.scala +++ b/scalalib/test/src/mill/scalalib/GenIdeaTests.scala @@ -13,6 +13,9 @@ object GenIdeaTests extends TestSuite { 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 @@ -34,6 +37,8 @@ object GenIdeaTests extends TestSuite { 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" ->