[WIP] Make Evaluator
only available to Task.Command(exclusive = true)
#3717
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a breaking change that tightens things up a bit following the introduction of
Task.Command(exclusive = true)
: now that we run commands in parallel, running multiple evaluator commands in parallel is dangerous, so they should be limited toexclusive
commandsIt's another step toward #502, by declaring that
exclusive
commands are different from normal commands, and thus need special treatmentDespite being binary compatible, we might not want to land this in 0.12.0, because it would break basically all usages of Evaluator commands in third-party plugins and force them to be updated, which defeats the purpose of maintaining bincompat. Probably better to wait till 0.13.0 when third-party plugins need to be fixed/recompiled anyway, and we can change the API (e.g. move to
Task.evaluator
) to force people to update their commands rather than happily compiling and then failing later at runtimeHad to jump through some hoops to do this without breaking bincompat:
ProxyEvaluator
that exposes all the same API, but looks up the currentEvaluator.currentEvaluatorSafe
on-demandEvaluator.currentEvaluatorSafe
is a version ofEvaluator.currentEvaluator
that only exists within exclusive commands, so we can fail with a nice error message if someone tries to use the evaluator inside a non-exclusive commandEvaluator.currentEvaluator
,mill.main.Tasks.TokensReader
actually needs to resolve the tasks early on and return aSeq
, which we cannot easily stub out.Evaluator
, and the tasks themselves are immutable and probably safe to use concurrency