A TaskExecutionGraph
is responsible for managing the execution of the Task instances which
are part of the build. The TaskExecutionGraph
maintains an execution plan of tasks to be executed (or
which have been executed), and you can query this plan from your build file.
You can access the TaskExecutionGraph
by calling Gradle.getTaskGraph.
In your build file you can use gradle.taskGraph
to access it.
The TaskExecutionGraph
is populated only after all the projects in the build have been evaulated. It
is empty before then. You can receive a notification when the graph is populated, using whenReady(groovy.lang.Closure) or addTaskExecutionGraphListener(TaskExecutionGraphListener).
Type | Name and description |
---|---|
void |
addTaskExecutionGraphListener(TaskExecutionGraphListener listener) |
void |
addTaskExecutionListener(TaskExecutionListener listener) |
void |
afterTask(Closure closure) |
void |
beforeTask(Closure closure) |
List<Task> |
getAllTasks() |
boolean |
hasTask(String path) |
boolean |
hasTask(Task task) |
void |
removeTaskExecutionGraphListener(TaskExecutionGraphListener listener) |
void |
removeTaskExecutionListener(TaskExecutionListener listener) |
void |
whenReady(Closure closure) |
Adds a listener to this graph, to be notified when this graph is ready.
listener
- The listener to add. Does nothing if this listener has already been added.
Adds a listener to this graph, to be notified as tasks are executed.
listener
- The listener to add. Does nothing if this listener has already been added.
Adds a closure to be called immediately after a task has executed. The task is passed to the closure as the first parameter. A TaskState is passed as the second parameter. Both parameters are optional.
closure
- The closure to execute when a task has been executed
Adds a closure to be called immediately before a task is executed. The task is passed to the closure as a parameter.
closure
- The closure to execute when a task is about to be executed.
Returns the tasks which are included in the execution plan. The tasks are returned in the order that they will be executed.
Determines whether the given task is included in the execution plan.
path
- the absolute path of the task.
Determines whether the given task is included in the execution plan.
task
- the task
Remove a listener from this graph.
listener
- The listener to remove. Does nothing if this listener was never added to this graph.
Remove a listener from this graph.
listener
- The listener to remove. Does nothing if this listener was never added to this graph.
Adds a closure to be called when this graph has been populated. This graph is passed to the closure as a parameter.
closure
- The closure to execute when this graph has been populated.