summaryrefslogtreecommitdiff
path: root/scalalib/src
diff options
context:
space:
mode:
authorNikolay Tatarinov <5min4eq.unity@gmail.com>2018-04-20 00:46:44 +0300
committerGitHub <noreply@github.com>2018-04-20 00:46:44 +0300
commit13d026574a5de41c42482d3ef20ab9ec7dd3bc20 (patch)
tree6077602163934bdc0dfb5cd6fbc1fc16c86daa6f /scalalib/src
parent7898368fe809779e73ef1cd909f1b2e5de84e6c1 (diff)
downloadmill-13d026574a5de41c42482d3ef20ab9ec7dd3bc20.tar.gz
mill-13d026574a5de41c42482d3ef20ab9ec7dd3bc20.tar.bz2
mill-13d026574a5de41c42482d3ef20ab9ec7dd3bc20.zip
Mark test module as test sources; change sbt module root (#298)
* mark test module as test sources * add test case for test module in GenIdea * fixes #201 change mill project path for sbt and maven tests
Diffstat (limited to 'scalalib/src')
-rw-r--r--scalalib/src/mill/scalalib/GenIdeaImpl.scala17
-rw-r--r--scalalib/src/mill/scalalib/JavaModule.scala2
-rw-r--r--scalalib/src/mill/scalalib/MiscModule.scala2
3 files changed, 15 insertions, 6 deletions
diff --git a/scalalib/src/mill/scalalib/GenIdeaImpl.scala b/scalalib/src/mill/scalalib/GenIdeaImpl.scala
index 760f2835..7ab6ffb7 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
+ ) = {
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url={"file://$MODULE_DIR$/" + relify(compileOutputPath) + "/dest/classes"} />
@@ -331,17 +336,17 @@ object GenIdeaImpl {
{
for (normalSourcePath <- normalSourcePaths.toSeq.sorted)
yield
- <sourceFolder url={"file://$MODULE_DIR$/" + relify(normalSourcePath)} isTestSource="false" />
+ <sourceFolder url={"file://$MODULE_DIR$/" + relify(normalSourcePath)} isTestSource={isTest.toString} />
}
{
for (generatedSourcePath <- generatedSourcePaths.toSeq.sorted)
yield
- <sourceFolder url={"file://$MODULE_DIR$/" + relify(generatedSourcePath)} isTestSource="false" generated="true" />
+ <sourceFolder url={"file://$MODULE_DIR$/" + relify(generatedSourcePath)} isTestSource={isTest.toString} generated="true" />
}
{
for (resourcePath <- resourcePaths.toSeq.sorted)
yield
- <sourceFolder url={"file://$MODULE_DIR$/" + relify(resourcePath)} isTestSource="false" type="java-resource" />
+ <sourceFolder url={"file://$MODULE_DIR$/" + relify(resourcePath)} isTestSource={isTest.toString} type="java-resource" />
}
<excludeFolder url={"file://$MODULE_DIR$/" + relify(basePath) + "/target"} />
</content>
diff --git a/scalalib/src/mill/scalalib/JavaModule.scala b/scalalib/src/mill/scalalib/JavaModule.scala
index 4b90331c..740bca2b 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 0e8bde3e..02a6ebf9 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
}
}