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

Derived new GenIdea module to support meta-builds #2638

Merged
merged 21 commits into from
Aug 21, 2023
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
10 changes: 7 additions & 3 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -1247,13 +1247,17 @@ object runner extends MillPublishScalaModule {
}
}

object idea extends MillPublishScalaModule {
def moduleDeps = Seq(scalalib, runner)
}

object dist extends MillPublishJavaModule {
def jar = dev.assembly()
def moduleDeps = Seq(runner)
def moduleDeps = Seq(runner, idea)
}

object dev extends MillPublishScalaModule {
def moduleDeps = Seq(runner)
def moduleDeps = Seq(runner, idea)

def testTransitiveDeps = super.testTransitiveDeps() ++ Seq(
runner.linenumbers.testDep(),
Expand Down Expand Up @@ -1437,7 +1441,7 @@ object docs extends Module {
PathRef(workDir / "build" / "site")
}

def source0: Source = T.source(millSourcePath)
def source0 = T.source(millSourcePath)
def source = T {
os.copy(source0().path, T.dest, mergeFolders = true)

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/Installation_IDE_Support.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ To generate IntelliJ IDEA project files into `.idea/`, run:

[source,bash]
----
mill mill.scalalib.GenIdea/idea
mill mill.idea.GenIdea/idea
----

== Updating Mill
Expand Down
25 changes: 25 additions & 0 deletions idea/src/mill/idea/GenIdea.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package mill.idea

import mill.T
import mill.api.Result
import mill.define.{Command, Discover, ExternalModule}
import mill.eval.Evaluator

import scala.util.control.NonFatal

object GenIdea extends ExternalModule {

def idea(allBootstrapEvaluators: Evaluator.AllBootstrapEvaluators): Command[Unit] = T.command {
try {
Result.Success(GenIdeaImpl(
evaluators = Evaluator.allBootstrapEvaluators.value.value
).run())
} catch {
case GenIdeaImpl.GenIdeaException(m) => Result.Failure(m)
case NonFatal(e) =>
Result.Exception(e, new Result.OuterStack(new java.lang.Exception().getStackTrace))
}
}

override lazy val millDiscover = Discover[this.type]
}
Loading