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

Added module docs for selective execution #4616

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions example/large/selective/9-selective-execution/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
//
// * `mill selective.run <selector>`: run on the codebase after the code change,
// runs tasks in the given `<selector>` which are affected by the code changes
// that have happen since `selective.prepare` was run
// that have happened since `selective.prepare` was run
//
// * `mill selective.resolve <selector>`: a dry-run version of `selective.run`, prints
// out the tasks in `<selector>` that are affected by the code changes and would have
// run, without actually tunning them.
// run, without actually running them.
//
// For example, if you want to run all tests related to the code changes in a pull
// request branch, you can do that as follows:
Expand Down
20 changes: 19 additions & 1 deletion main/src/mill/main/MainModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,25 @@ trait MainModule extends BaseModule {

/**
* Commands related to selective execution, where Mill runs tasks selectively
* depending on what task inputs or implementations changed
* depending on what task inputs or implementations changed.
*
* Read more about it at: https://mill-build.org/mill/large/selective-execution.html
*
* Here are the essential commands:
*
* - `mill selective.prepare <selector>`:
* run on the codebase before the code change,
* stores a snapshot of task inputs and implementations
*
* - `mill selective.run <selector>`:
* run on the codebase after the code change,
* runs tasks in the given `<selector>` which are affected by the code changes
* that have happened since `selective.prepare` was run
*
* - `mill selective.resolve <selector>`:
* a dry-run version of `selective.run`,
* prints out the tasks in `<selector>`` that are affected by the code changes
* and would have run, without actually running them.
*/
lazy val selective: SelectiveExecutionModule = new SelectiveExecutionModule {}

Expand Down
21 changes: 21 additions & 0 deletions main/src/mill/main/SelectiveExecutionModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@ import mill.define.{Command, Task}
import mill.eval.{Evaluator, SelectiveExecution}
import mill.define.SelectMode

/**
* Mill Module to support selective test execution in large projects.
*
* Read more about it at: https://mill-build.org/mill/large/selective-execution.html
*
* Here are the essential commands:
*
* - `mill selective.prepare <selector>`:
* run on the codebase before the code change,
* stores a snapshot of task inputs and implementations
*
* - `mill selective.run <selector>`:
* run on the codebase after the code change,
* runs tasks in the given `<selector>` which are affected by the code changes
* that have happened since `selective.prepare` was run
*
* - `mill selective.resolve <selector>`:
* a dry-run version of `selective.run`,
* prints out the tasks in `<selector>`` that are affected by the code changes
* and would have run, without actually running them.
*/
trait SelectiveExecutionModule extends mill.define.Module {

/**
Expand Down