From 482f5407082ff44b0c084ad80adbf903d7fdc6b9 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Tue, 9 Oct 2018 03:36:46 +0200 Subject: [PATCH] Configure Idea project generator per module (#458) * Sketched how to skip some projects from Idea project generator * Better trait comment * Moved skipIdea flag into JavaModule --- scalalib/src/mill/scalalib/GenIdeaImpl.scala | 6 ++++-- scalalib/src/mill/scalalib/JavaModule.scala | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/scalalib/src/mill/scalalib/GenIdeaImpl.scala b/scalalib/src/mill/scalalib/GenIdeaImpl.scala index f71a7856fd8..b4f77f16bcf 100644 --- a/scalalib/src/mill/scalalib/GenIdeaImpl.scala +++ b/scalalib/src/mill/scalalib/GenIdeaImpl.scala @@ -26,6 +26,7 @@ object GenIdea extends ExternalModule { implicit def millScoptEvaluatorReads[T] = new mill.main.EvaluatorScopt[T]() lazy val millDiscover = Discover[this.type] } + object GenIdeaImpl { def apply(ctx: Log with Home, @@ -225,8 +226,9 @@ object GenIdeaImpl { Tuple2( ".idea"/"modules.xml", allModulesXmlTemplate( - for((path, mod) <- modules) - yield moduleName(path) + modules + .filter(!_._2.skipIdea) + .map { case (path, mod) => moduleName(path) } ) ), Tuple2( diff --git a/scalalib/src/mill/scalalib/JavaModule.scala b/scalalib/src/mill/scalalib/JavaModule.scala index b15e0bdb86d..15fa7264902 100644 --- a/scalalib/src/mill/scalalib/JavaModule.scala +++ b/scalalib/src/mill/scalalib/JavaModule.scala @@ -527,6 +527,11 @@ trait JavaModule extends mill.Module with TaskModule { outer => def intellijModulePath: Path = millSourcePath def forkWorkingDir = T{ ammonite.ops.pwd } + + /** + * Skip Idea project file generation. + */ + def skipIdea: Boolean = false } trait TestModule extends JavaModule with TaskModule {