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

Allow Mill CLI to select the meta-build frame it operates on #2719

Merged
merged 19 commits into from
Sep 2, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Hold the evaluator in an Option to make non-existence safe
lefou committed Sep 1, 2023
commit df392a2648cd30bce4bff3aa5ae8b2f4a2ca2c37
16 changes: 8 additions & 8 deletions runner/src/mill/runner/MillBuildBootstrap.scala
Original file line number Diff line number Diff line change
@@ -132,10 +132,10 @@ class MillBuildBootstrap(
Map.empty,
None,
Nil,
// FIXME we don't want to evaluator anything in this depth, so we just skip creating an evaluator,
// We set this to None here.
// We don't want to evaluate anything in this depth, so we just skip creating an evaluator,
// mainly because we didn't even constructed (compiled) it's classpath
// TODO: Instead, introduce a skipped frame type, so we can better comunicate that state
null
None
)
nestedState.add(frame = evalState, errorOpt = None)
} else {
@@ -232,7 +232,7 @@ class MillBuildBootstrap(
Map.empty,
None,
Nil,
evaluator
Option(evaluator)
)

nestedState.add(frame = evalState, errorOpt = Some(error))
@@ -282,7 +282,7 @@ class MillBuildBootstrap(
methodCodeHashSignatures,
Some(classLoader),
runClasspath,
evaluator
Option(evaluator)
)

nestedState.add(frame = evalState)
@@ -300,10 +300,10 @@ class MillBuildBootstrap(
evaluator: Evaluator
): RunnerState = {

assert(nestedState.frames.forall(_.evaluator != null))
assert(nestedState.frames.forall(_.evaluator.isDefined))

val (evaled, evalWatched, moduleWatches) = Evaluator.allBootstrapEvaluators.withValue(
Evaluator.AllBootstrapEvaluators(Seq(evaluator) ++ nestedState.frames.map(_.evaluator))
Evaluator.AllBootstrapEvaluators(Seq(evaluator) ++ nestedState.frames.flatMap(_.evaluator))
) {
evaluateWithWatches(rootModule, evaluator, targetsAndParams)
}
@@ -316,7 +316,7 @@ class MillBuildBootstrap(
Map.empty,
None,
Nil,
evaluator
Option(evaluator)
)

nestedState.add(frame = evalState, errorOpt = evaled.left.toOption)
2 changes: 1 addition & 1 deletion runner/src/mill/runner/RunnerState.scala
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ object RunnerState {
methodCodeHashSignatures: Map[String, Int],
classLoaderOpt: Option[RunnerState.URLClassLoader],
runClasspath: Seq[PathRef],
evaluator: Evaluator
evaluator: Option[Evaluator]
) {

def loggedData: Frame.Logged = {