interface TaskExecutionGraph
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 org.gradle.api.invocation.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
or #addTaskExecutionGraphListener(TaskExecutionGraphListener)
.
abstract fun addTaskExecutionGraphListener(listener: TaskExecutionGraphListener): Unit
Adds a listener to this graph, to be notified when this graph is ready. |
|
abstract fun addTaskExecutionListener(listener: TaskExecutionListener): Unit
Adds a listener to this graph, to be notified as tasks are executed. |
|
abstract fun afterTask(closure: Closure<Any>): Unit
Adds a closure to be called immediately after a task has executed. The task is passed to the closure as the first parameter. A org.gradle.api.tasks.TaskState is passed as the second parameter. Both parameters are optional. abstract fun afterTask(action: Action<Task>): Unit
Adds an action to be called immediately after a task has executed. The task is passed to the action as the first parameter. |
|
abstract fun beforeTask(closure: Closure<Any>): Unit
Adds a closure to be called immediately before a task is executed. The task is passed to the closure as a parameter. abstract fun beforeTask(action: Action<Task>): Unit
Adds an action to be called immediately before a task is executed. The task is passed to the action as a parameter. |
|
abstract fun getAllTasks(): MutableList<Task>
Returns the tasks which are included in the execution plan. The tasks are returned in the order that they will be executed. |
|
abstract fun getDependencies(task: Task): MutableSet<Task>
Returns the dependencies of a task which are part of the execution graph. |
|
abstract fun hasTask(path: String): Boolean abstract fun hasTask(task: Task): Boolean
Determines whether the given task is included in the execution plan. |
|
abstract fun removeTaskExecutionGraphListener(listener: TaskExecutionGraphListener): Unit
Remove a listener from this graph. |
|
abstract fun removeTaskExecutionListener(listener: TaskExecutionListener): Unit
Remove a listener from this graph. |
|
abstract fun whenReady(closure: Closure<Any>): Unit
Adds a closure to be called when this graph has been populated. This graph is passed to the closure as a parameter. abstract fun whenReady(action: Action<TaskExecutionGraph>): Unit
Adds an action to be called when this graph has been populated. This graph is passed to the action as a parameter. |