org.gradle.execution
Class DefaultTaskExecuter

java.lang.Object
  extended by org.gradle.execution.DefaultTaskExecuter
All Implemented Interfaces:
TaskExecutionGraph, TaskExecuter

public class DefaultTaskExecuter
extends java.lang.Object
implements TaskExecuter


Constructor Summary
DefaultTaskExecuter()
           
 
Method Summary
 void addTaskExecutionGraphListener(TaskExecutionGraphListener listener)
          Adds a listener to this graph, to be notified when this graph is ready.
 void addTaskExecutionListener(TaskExecutionListener listener)
          Adds a listener to this graph, to be notified as tasks are executed.
 void addTasks(java.lang.Iterable<? extends Task> tasks)
          Adds the given tasks and their dependencies to this graph.
 void afterTask(groovy.lang.Closure closure)
          Adds a closure to be called immediately after a task has executed.
 void beforeTask(groovy.lang.Closure closure)
          Adds a closure to be called immediately before a task is executed.
 void execute()
          Executes the tasks in this graph.
 void execute(java.lang.Iterable<? extends Task> tasks)
          Adds the given tasks and their dependencies to this graph, then executes all the tasks in this graph.
 java.util.List<Task> getAllTasks()
          Returns the tasks which are included in the execution plan.
 boolean hasTask(java.lang.String path)
          Determines whether the given task is included in the execution plan.
 boolean hasTask(Task task)
          Determines whether the given task is included in the execution plan.
 void removeTaskExecutionGraphListener(TaskExecutionGraphListener listener)
          Remove a listener from this graph.
 void removeTaskExecutionListener(TaskExecutionListener listener)
          Remove a listener from this graph.
 void whenReady(groovy.lang.Closure closure)
          Adds a closure to be called when this graph has been populated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTaskExecuter

public DefaultTaskExecuter()
Method Detail

addTasks

public void addTasks(java.lang.Iterable<? extends Task> tasks)
Description copied from interface: TaskExecuter
Adds the given tasks and their dependencies to this graph. Tasks are executed in an arbitrary order. The tasks are executed before any tasks from a subsequent call to this method are executed.

Specified by:
addTasks in interface TaskExecuter

execute

public void execute()
Description copied from interface: TaskExecuter
Executes the tasks in this graph. Discards the contents of this graph when completed.

Specified by:
execute in interface TaskExecuter

execute

public void execute(java.lang.Iterable<? extends Task> tasks)
Description copied from interface: TaskExecuter
Adds the given tasks and their dependencies to this graph, then executes all the tasks in this graph. Discards the contents of this graph when completed.

Specified by:
execute in interface TaskExecuter

addTaskExecutionGraphListener

public void addTaskExecutionGraphListener(TaskExecutionGraphListener listener)
Description copied from interface: TaskExecutionGraph

Adds a listener to this graph, to be notified when this graph is ready.

Specified by:
addTaskExecutionGraphListener in interface TaskExecutionGraph
Parameters:
listener - The listener to add. Does nothing if this listener has already been added.

removeTaskExecutionGraphListener

public void removeTaskExecutionGraphListener(TaskExecutionGraphListener listener)
Description copied from interface: TaskExecutionGraph

Remove a listener from this graph.

Specified by:
removeTaskExecutionGraphListener in interface TaskExecutionGraph
Parameters:
listener - The listener to remove. Does nothing if this listener was never added to this graph.

whenReady

public void whenReady(groovy.lang.Closure closure)
Description copied from interface: TaskExecutionGraph

Adds a closure to be called when this graph has been populated. This graph is passed to the closure as a parameter.

Specified by:
whenReady in interface TaskExecutionGraph
Parameters:
closure - The closure to execute when this graph has been populated.

addTaskExecutionListener

public void addTaskExecutionListener(TaskExecutionListener listener)
Description copied from interface: TaskExecutionGraph

Adds a listener to this graph, to be notified as tasks are executed.

Specified by:
addTaskExecutionListener in interface TaskExecutionGraph
Parameters:
listener - The listener to add. Does nothing if this listener has already been added.

removeTaskExecutionListener

public void removeTaskExecutionListener(TaskExecutionListener listener)
Description copied from interface: TaskExecutionGraph

Remove a listener from this graph.

Specified by:
removeTaskExecutionListener in interface TaskExecutionGraph
Parameters:
listener - The listener to remove. Does nothing if this listener was never added to this graph.

beforeTask

public void beforeTask(groovy.lang.Closure closure)
Description copied from interface: TaskExecutionGraph

Adds a closure to be called immediately before a task is executed. The task is passed to the closure as a parameter.

Specified by:
beforeTask in interface TaskExecutionGraph
Parameters:
closure - The closure to execute when a task is about to be executed.

afterTask

public void afterTask(groovy.lang.Closure closure)
Description copied from interface: TaskExecutionGraph

Adds a closure to be called immediately after a task has executed. The task is passed to the closure as the first parameter. The task execution exception, if any, is passed as the second parameter. Both parameters are optional.

Specified by:
afterTask in interface TaskExecutionGraph
Parameters:
closure - The closure to execute when a task has been executed

hasTask

public boolean hasTask(Task task)
Description copied from interface: TaskExecutionGraph

Determines whether the given task is included in the execution plan.

Specified by:
hasTask in interface TaskExecutionGraph
Parameters:
task - the task
Returns:
true if the given task is included in the execution plan.

hasTask

public boolean hasTask(java.lang.String path)
Description copied from interface: TaskExecutionGraph

Determines whether the given task is included in the execution plan.

Specified by:
hasTask in interface TaskExecutionGraph
Parameters:
path - the absolute path of the task.
Returns:
true if a task with the given path is included in the execution plan.

getAllTasks

public java.util.List<Task> getAllTasks()
Description copied from interface: TaskExecutionGraph

Returns the tasks which are included in the execution plan. The tasks are returned in the order that they will be executed.

Specified by:
getAllTasks in interface TaskExecutionGraph
Returns:
The tasks. Returns an empty set if no tasks are to be executed.