-
-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce
Task.Command(exclusive = true)
and convert `Task.Persiste…
…nt` to `Task(persistent = true)` (#3617) fixes #3566. Mostly a straightforward implementation of what was discussed. We use `Task.Command(exclusive = true)` to make `console`/`repl`/`clean`/etc. run serially, all other commands should run in parallel. That includes most `test` commands. The name `exclusive` is taken from the Bazel action/target tag with the same meaning: that the tagged action runs alone with no other actions in parallel `Task.Persistent` was changed to `Task(persistent = true)` for consistency, and also for other reasons: the new syntax is more composable, e.g. a user can more easily choose whether they want `persistent = true` or `persistent = false` based on a computed `Boolean` value, and Mill can in future extend it such that we can have `Task(exclusive = true, persistent = true)`, `Task.Command(exclusive = true, persistent = true)`, or other such combinations perhaps with even more flags (e.g. Bazel has a pretty long list https://bazel.build/reference/be/common-definitions#common.tags). To make overload resolution work correctly, I make the first parameter of the `(exclusive = true)` or `(persistent = true)` parameter list `dummy: NamedParameterOnlyDummy.type = NamedParameterOnlyDummy`. This ensures that there is no normal value the user could pass in positionally that would select that overload of `def Command` or `def apply`, and the only way to select it is by passing in `exclusive = true` or `persistent = true` as a named parameter Tested manually by adding `println`s and making sure that `leafSerialCommands` no longer contains test tasks when I run tests in `example/scalalib/basic/1-simple`.
- Loading branch information
Showing
18 changed files
with
387 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package mill.define | ||
|
||
/** | ||
* Dummy class used to mark parameters that come after it as named only parameters | ||
*/ | ||
class NamedParameterOnlyDummy private[mill] () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.