Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Idea project generator per module #458

Merged
merged 3 commits into from
Oct 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions scalalib/src/mill/scalalib/GenIdeaImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -225,8 +226,9 @@ object GenIdeaImpl {
Tuple2(
".idea"/"modules.xml",
allModulesXmlTemplate(
for((path, mod) <- modules)
yield moduleName(path)
modules
.filter(!_._2.skipIdea)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use a collect instead to avoid iterating over the modules twice

.collect {
  case (path, mod) if !mod.skipIdea => moduleName(path)
}

.map { case (path, mod) => moduleName(path) }
)
),
Tuple2(
Expand Down
5 changes: 5 additions & 0 deletions scalalib/src/mill/scalalib/JavaModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down