-
-
Notifications
You must be signed in to change notification settings - Fork 354
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
Use original Evaluator
s to preserve their association with modules in BSP to avoid using the wrong evaluator
#2692
Conversation
Evaluator
s to preserve their association with modules in BSP to avoid using the wrong evaluator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I added some small nits.
disableCallgraphInvalidation = disableCallgraphInvalidation, | ||
needBuildSc = true | ||
).evaluate() | ||
lazy val rootModules = evaluators.map(_.rootModule) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type needed
implicit def millAllEvaluatorsTokenReader[T]: mainargs.TokensReader[Seq[Evaluator]] = | ||
new mill.main.AllEvaluatorsTokenReader[T]() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a Seq[Evaluator]
to express the wish to get all evaluators is a bit vague. A Seq can hold almost everything, also nothing. Should we introduce a dedicated type to hold all evaluators instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll wrap it in Evaluator.AllBootstrapEvaluators(value: Seq[Evaluator])
Should fix #2643.
The basic problem is previously BSP always used the
frame(0)
evaluator passed in toupdateEvaluator
, which is meant specifically for evaluating user tasks in the root./build.sc
. However, BSP also querying of modules and tasks both inbuild.sc
as well as meta-builds inmill-build/build.sc
and nested meta-builds. This ends up evaluating the meta-builds in the sameout/
folder as the main build, rather than in theout/mill-build/
folders they should be evaluated in.This PR avoids using the
Evaluator
given inupdateEvaluator
, and instead preserves theEvaluator
s we already construct as part ofMillBuildBootstrap
inmill.bsp.worker.State
, and passes them as aSeq[Evaluator]
from the enclosingMillBuildBootstrap
code all the way to the Mill-BSP code so we can associate eachModule
with its respectiveEaluator
. We then use those associatedEvaluator
s to perform the actual evaluation throughout theMill{Scala,Java,Jvm,}BuildServer
implementations. There's some additional re-shaping, so that in case a single BSP API call wants to query modules/tasks from multiple evaluators at once we properly group the tasks/modules together according to their respective evaluators for evaluation.By passing the
Seq[Evaluator]
from the enclosingMillBuildBootstrap
, this also lets us remove the now-redundant call toMillBuildBootstrap
buried withinState.scala
. We already have all the necessary data structures from the enclosingMillBuildBootstrap
and its evaluators, so we don't need to re-run the bootstrap process and re-construct all of it from scratch just for BSPI haven't managed to reproduce the original error, so confirming the fix will have to wait until this lands in master and people can try it out. But I have manually tested using VSCode to load and jump around
example/basic/1-simple-scala/
andexample/scalabuilds/10-scala-realistic/
, and it seems all the references and modules work and are set up correctly. So at least we have some confidence that this doesn't cause any regressions.This should also supersede #2648, since we now no longer need to re-run the
MillBuildBootstrap
/RootModuleFinder
logic at all since we just take the existing list ofEvaluator
s from the enclosing bootstrap process