summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Roeser <le.petit.fou@web.de>2019-11-05 18:05:52 +0100
committerGitHub <noreply@github.com>2019-11-05 18:05:52 +0100
commitea4f04d3d2b706ca65d8298327d8ac9d9504adda (patch)
treef68a22be31c101e308745a53bfc54a7b6d6726aa
parent1fea4221f68aeb3886a167c71699cfd316dc544f (diff)
downloadmill-ea4f04d3d2b706ca65d8298327d8ac9d9504adda.tar.gz
mill-ea4f04d3d2b706ca65d8298327d8ac9d9504adda.tar.bz2
mill-ea4f04d3d2b706ca65d8298327d8ac9d9504adda.zip
Create separate content entries for generated sources (#729)
* Create separate content entries for generated sources Fixes https://github.com/lihaoyi/mill/issues/728 * Fixed handling of duplictate entries * Updated tests for GenIdea
-rwxr-xr-xscalalib/src/GenIdeaImpl.scala16
-rw-r--r--scalalib/test/resources/gen-idea-extended-hello-world/idea_modules/helloworld.iml4
-rw-r--r--scalalib/test/resources/gen-idea-extended-hello-world/idea_modules/helloworld.test.iml4
-rw-r--r--scalalib/test/resources/gen-idea-hello-world/idea_modules/helloworld.iml4
-rw-r--r--scalalib/test/resources/gen-idea-hello-world/idea_modules/helloworld.test.iml4
5 files changed, 22 insertions, 10 deletions
diff --git a/scalalib/src/GenIdeaImpl.scala b/scalalib/src/GenIdeaImpl.scala
index c0e41426..03f38b62 100755
--- a/scalalib/src/GenIdeaImpl.scala
+++ b/scalalib/src/GenIdeaImpl.scala
@@ -545,19 +545,23 @@ case class GenIdeaImpl(evaluator: Evaluator,
<output url={outputUrl} />
}
<exclude-output />
- <content url={"file://$MODULE_DIR$/" + relify(generatedSourceOutputPath)} />
+ {
+ for {
+ generatedSourcePath <- (generatedSourcePaths.toSeq ++ Seq(generatedSourceOutputPath)).distinct.sorted
+ path <- Seq(relify(generatedSourcePath))
+ } yield
+ <content url={"file://$MODULE_DIR$/" + path}>
+ <sourceFolder url={"file://$MODULE_DIR$/" + path} isTestSource={isTest.toString} generated="true" />
+ </content>
+ }
<content url={"file://$MODULE_DIR$/" + relify(basePath)}>
{
+ // keep the "real" base path as last content, to ensure, Idea picks it up as "main" module dir
for (normalSourcePath <- normalSourcePaths.toSeq.sorted)
yield
<sourceFolder url={"file://$MODULE_DIR$/" + relify(normalSourcePath)} isTestSource={isTest.toString} />
}
{
- for (generatedSourcePath <- generatedSourcePaths.toSeq.sorted)
- yield
- <sourceFolder url={"file://$MODULE_DIR$/" + relify(generatedSourcePath)} isTestSource={isTest.toString} generated="true" />
- }
- {
val resourceType = if (isTest) "java-test-resource" else "java-resource"
for (resourcePath <- resourcePaths.toSeq.sorted)
yield
diff --git a/scalalib/test/resources/gen-idea-extended-hello-world/idea_modules/helloworld.iml b/scalalib/test/resources/gen-idea-extended-hello-world/idea_modules/helloworld.iml
index 8d00490f..e0ebc89c 100644
--- a/scalalib/test/resources/gen-idea-extended-hello-world/idea_modules/helloworld.iml
+++ b/scalalib/test/resources/gen-idea-extended-hello-world/idea_modules/helloworld.iml
@@ -2,7 +2,9 @@
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/../out/HelloWorld/ideaCompileOutput/dest/classes"/>
<exclude-output/>
- <content url="file://$MODULE_DIR$/../out/HelloWorld/generatedSources/dest"/>
+ <content url="file://$MODULE_DIR$/../out/HelloWorld/generatedSources/dest">
+ <sourceFolder url="file://$MODULE_DIR$/../out/HelloWorld/generatedSources/dest" isTestSource="false" generated="true"/>
+ </content>
<content url="file://$MODULE_DIR$/../HelloWorld">
<sourceFolder url="file://$MODULE_DIR$/../HelloWorld/src" isTestSource="false"/>
<sourceFolder url="file://$MODULE_DIR$/../HelloWorld/resources" type="java-resource"/>
diff --git a/scalalib/test/resources/gen-idea-extended-hello-world/idea_modules/helloworld.test.iml b/scalalib/test/resources/gen-idea-extended-hello-world/idea_modules/helloworld.test.iml
index 79be6671..138fa7ea 100644
--- a/scalalib/test/resources/gen-idea-extended-hello-world/idea_modules/helloworld.test.iml
+++ b/scalalib/test/resources/gen-idea-extended-hello-world/idea_modules/helloworld.test.iml
@@ -2,7 +2,9 @@
<component name="NewModuleRootManager">
<output-test url="file://$MODULE_DIR$/../out/HelloWorld/test/ideaCompileOutput/dest/classes"/>
<exclude-output/>
- <content url="file://$MODULE_DIR$/../out/HelloWorld/test/generatedSources/dest"/>
+ <content url="file://$MODULE_DIR$/../out/HelloWorld/test/generatedSources/dest">
+ <sourceFolder url="file://$MODULE_DIR$/../out/HelloWorld/test/generatedSources/dest" isTestSource="true" generated="true"/>
+ </content>
<content url="file://$MODULE_DIR$/../HelloWorld/test">
<sourceFolder url="file://$MODULE_DIR$/../HelloWorld/test/src" isTestSource="true"/>
<sourceFolder url="file://$MODULE_DIR$/../HelloWorld/test/resources" type="java-test-resource"/>
diff --git a/scalalib/test/resources/gen-idea-hello-world/idea_modules/helloworld.iml b/scalalib/test/resources/gen-idea-hello-world/idea_modules/helloworld.iml
index cc3c0ce2..a4f3e9bd 100644
--- a/scalalib/test/resources/gen-idea-hello-world/idea_modules/helloworld.iml
+++ b/scalalib/test/resources/gen-idea-hello-world/idea_modules/helloworld.iml
@@ -2,7 +2,9 @@
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/../out/HelloWorld/ideaCompileOutput/dest/classes"/>
<exclude-output/>
- <content url="file://$MODULE_DIR$/../out/HelloWorld/generatedSources/dest"/>
+ <content url="file://$MODULE_DIR$/../out/HelloWorld/generatedSources/dest">
+ <sourceFolder url="file://$MODULE_DIR$/../out/HelloWorld/generatedSources/dest" isTestSource="false" generated="true"/>
+ </content>
<content url="file://$MODULE_DIR$/../HelloWorld">
<sourceFolder url="file://$MODULE_DIR$/../HelloWorld/src" isTestSource="false"/>
<sourceFolder url="file://$MODULE_DIR$/../HelloWorld/resources" type="java-resource"/>
diff --git a/scalalib/test/resources/gen-idea-hello-world/idea_modules/helloworld.test.iml b/scalalib/test/resources/gen-idea-hello-world/idea_modules/helloworld.test.iml
index 79be6671..138fa7ea 100644
--- a/scalalib/test/resources/gen-idea-hello-world/idea_modules/helloworld.test.iml
+++ b/scalalib/test/resources/gen-idea-hello-world/idea_modules/helloworld.test.iml
@@ -2,7 +2,9 @@
<component name="NewModuleRootManager">
<output-test url="file://$MODULE_DIR$/../out/HelloWorld/test/ideaCompileOutput/dest/classes"/>
<exclude-output/>
- <content url="file://$MODULE_DIR$/../out/HelloWorld/test/generatedSources/dest"/>
+ <content url="file://$MODULE_DIR$/../out/HelloWorld/test/generatedSources/dest">
+ <sourceFolder url="file://$MODULE_DIR$/../out/HelloWorld/test/generatedSources/dest" isTestSource="true" generated="true"/>
+ </content>
<content url="file://$MODULE_DIR$/../HelloWorld/test">
<sourceFolder url="file://$MODULE_DIR$/../HelloWorld/test/src" isTestSource="true"/>
<sourceFolder url="file://$MODULE_DIR$/../HelloWorld/test/resources" type="java-test-resource"/>