|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TaskContainer
A TaskContainer
is responsible for managing a set of Task
instances.
You can obtain a TaskContainer
instance by calling Project.getTasks()
, or using the
tasks
property in your build script.
Method Summary | ||
---|---|---|
Task |
add(Map<String,?> options)
Creates a Task and adds it to this container. |
|
Task |
add(Map<String,?> options,
Closure configureClosure)
Creates a Task adds it to this container. |
|
Task |
add(String name)
Creates a Task with the given name and adds it to this container. |
|
|
add(String name,
Class<T> type)
Creates a Task with the given name and type, and adds it to this container. |
|
Task |
add(String name,
Closure configureClosure)
Creates a Task with the given name adds it to this container. |
|
Task |
findByPath(String path)
Locates a task by path. |
|
Task |
getByPath(String path)
Locates a task by path. |
|
Task |
replace(String name)
Creates a Task with the given name and adds it to this container, replacing any existing task with the
same name. |
|
|
replace(String name,
Class<T> type)
Creates a Task with the given name and type, and adds it to this container, replacing any existing
task of the same name. |
Methods inherited from interface org.gradle.api.tasks.TaskCollection |
---|
allTasks, allTasks, getAt, getByName, getByName, matching, matching, whenTaskAdded, whenTaskAdded, withType |
Methods inherited from interface org.gradle.api.NamedDomainObjectCollection |
---|
findByName, getAsMap |
Methods inherited from interface org.gradle.api.DomainObjectCollection |
---|
allObjects, allObjects, findAll, getAll, whenObjectAdded, whenObjectAdded, whenObjectRemoved |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Methods inherited from interface org.gradle.api.NamedDomainObjectContainer |
---|
addRule, addRule, getRules |
Methods inherited from interface org.gradle.api.NamedDomainObjectCollection |
---|
findByName, getAsMap |
Methods inherited from interface org.gradle.api.DomainObjectCollection |
---|
allObjects, allObjects, findAll, getAll, whenObjectAdded, whenObjectAdded, whenObjectRemoved |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
Task findByPath(String path)
Locates a task by path. You can supply a task name, a relative path, or an absolute path. Relative paths are interpreted relative to the project for this container. This method returns null if no task with the given path exists.
path
- the path of the task to be returned
Task getByPath(String path) throws UnknownTaskException
Locates a task by path. You can supply a task name, a relative path, or an absolute path. Relative paths are interpreted relative to the project for this container. This method throws an exception if no task with the given path exists.
path
- the path of the task to be returned
UnknownTaskException
- If no task with the given path exists.Task add(Map<String,?> options) throws InvalidUserDataException
Creates a Task
and adds it to this container. A map of creation options can be passed to this method
to control how the task is created. The following options are available:
Option | Description | Default Value |
---|---|---|
"name" | The name of the task to create. | None. Must be specified. |
"type" | The class of the task to create. | DefaultTask |
"action" | The closure or TaskAction to
execute when the task executes. See Task.doFirst(Action) . | null |
"overwrite" | Replace an existing task? | false |
"dependsOn" | The dependencies of the task. See here for more details. | [] |
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
If a task with the given name already exists in this container and the override
option is not set
to true, an exception is thrown.
options
- The task creation options.
InvalidUserDataException
- If a task with the given name already exsists in this project.Task add(Map<String,?> options, Closure configureClosure) throws InvalidUserDataException
Creates a Task
adds it to this container. A map of creation options can be passed to this method to
control how the task is created. See add(java.util.Map)
for the list of options available. The given
closure is used to configure the task before it is returned by this method.
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
options
- The task creation options.configureClosure
- The closure to use to configure the task.
InvalidUserDataException
- If a task with the given name already exsists in this project.Task add(String name, Closure configureClosure) throws InvalidUserDataException
Creates a Task
with the given name adds it to this container. The given closure is used to configure
the task before it is returned by this method.
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
name
- The name of the task to be createdconfigureClosure
- The closure to use to configure the task.
InvalidUserDataException
- If a task with the given name already exsists in this project.Task add(String name) throws InvalidUserDataException
Creates a Task
with the given name and adds it to this container.
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
name
- The name of the task to be created
InvalidUserDataException
- If a task with the given name already exsists in this project.<T extends Task> T add(String name, Class<T> type) throws InvalidUserDataException
Creates a Task
with the given name and type, and adds it to this container.
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
name
- The name of the task to be created.type
- The type of task to create.
InvalidUserDataException
- If a task with the given name already exsists in this project.Task replace(String name)
Creates a Task
with the given name and adds it to this container, replacing any existing task with the
same name.
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
name
- The name of the task to be created
InvalidUserDataException
- If a task with the given name already exsists in this project.<T extends Task> T replace(String name, Class<T> type)
Creates a Task
with the given name and type, and adds it to this container, replacing any existing
task of the same name.
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
name
- The name of the task to be created.type
- The type of task to create.
InvalidUserDataException
- If a task with the given name already exsists in this project.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |