Skip to content

Commit 13ae7cf

Browse files
committed
update doc
1 parent 685a361 commit 13ae7cf

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

example/extending/evaluator/1-resolve-segments/build.mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object `package` extends ScalaModule {
2424
.get
2525

2626
segmentsResult.foreach { segment =>
27-
println(s"Segment: ${segment.parts.mkString(", ")}")
27+
println(s"Segment: ${segment.render}")
2828
}
2929
()
3030
}

example/extending/evaluator/4-execute/build.mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ object `package` extends ScalaModule {
3939
/** Usage
4040

4141
> ./mill customExecuteCommand assembly
42-
.../assembly.dest/out.jar))
42+
.../assembly.dest/out.jar...
4343

4444
*/

example/extending/evaluator/5-evaluate/build.mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ object `package` extends ScalaModule {
3636
/** Usage
3737

3838
> ./mill customEvaluateCommand assembly
39-
.../assembly.dest/out.jar))
39+
.../assembly.dest/out.jar...
4040

4141
*/

website/docs/modules/ROOT/pages/extending/evaluator.adoc

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
= Evaluator API Commands
22

3+
The Mill `Evaluator` API provides programmatic access to Mill's core functionalities, allowing you to resolve, plan, and execute build tasks directly.
4+
This API is essential for extending Mill built-in features through interaction and control of the build process.
5+
36
== `resolveSegments`
47

58
Resolves a sequence of Mill selector strings (such as task or module names) into a list of fully-qualified segment paths matching tasks or modules in the build.
@@ -13,6 +16,10 @@ Resolves a sequence of Mill selector strings (such as task or module names) into
1316
=== Returns:
1417
- `mill.api.Result[List[Segments]]` - A result wrapping the list of resolved segment paths (`Segments`).
1518

19+
=== Use Case:
20+
Use this when you want to resolve a list of query selector into a list of `mill.api.Segments`.
21+
`Segments` represent the "path" or selector for tasks or modules, but not the tasks themselves.
22+
1623
=== Example Usage:
1724

1825
include::partial$example/extending/evaluator/1-resolve-segments.adoc[]
@@ -31,6 +38,10 @@ Resolves a sequence of selector strings into a list of concrete Mill tasks (`Tas
3138
=== Returns
3239
- `mill.api.Result[List[Task.Named[?]]]` - List of resolved named tasks.
3340

41+
=== Use Case:
42+
Use this when you want to resolve the same query selector strings into actual `Task.Named` instances.
43+
These represent concrete tasks or modules that will be executed or inspected
44+
3445
=== Example Usage:
3546

3647
include::partial$example/extending/evaluator/2-resolve-tasks.adoc[]
@@ -44,7 +55,10 @@ Computes and returns the execution plan (ordered task list) for a set of resolve
4455
- `tasks: Seq[Task.Named[?]]` - List of tasks to plan.
4556

4657
=== Returns:
47-
- `Plan` - A type with execution plan details (including all transitive tasks and their sorted grouping).
58+
- `Plan` - An object containing execution plan details (including all transitive tasks and their sorted grouping).
59+
60+
=== Use Case:
61+
Use this when you need to inspect the sequence of tasks Mill would execute for a given set of targets, without actually performing the execution. This is useful for debugging or understanding dependencies.
4862

4963
=== Example Usage:
5064

@@ -66,6 +80,10 @@ Executes a list of tasks and returns the results of their evaluation.
6680
=== Returns:
6781
- `Evaluator.Result[T]` - Contains results of tasks executed, any watched files, and success/failure info for each task.
6882

83+
=== Use Case:
84+
Choose `execute` when you needs to programmatically run one or more specific Mill tasks and you require access to their execution results, such as the output values, or success/failure status.
85+
This is central for implementing conditional build logic, integrating with external tools, or collecting custom build metrics after tasks have completed.
86+
6987
=== Example Usage:
7088

7189
include::partial$example/extending/evaluator/4-execute.adoc[]
@@ -83,6 +101,9 @@ Evaluates tasks given as selector strings, resolving them first.
83101
=== Returns:
84102
- `mill.api.Result[Evaluator.Result[Any]]` - The result of evaluating the tasks (including outputs, watched files, etc).
85103

104+
=== Use Case:
105+
Use this when you need to quickly evaluate tasks with a single command specified by selector strings without needing to explicitly resolve them first.
106+
86107
=== Example Usage:
87108

88109
include::partial$example/extending/evaluator/5-evaluate.adoc[]

0 commit comments

Comments
 (0)