interface TaskContainer : TaskCollection<Task>, PolymorphicDomainObjectContainer<Task>
A TaskContainer
is responsible for managing a set of Task instances.
You can obtain a TaskContainer
instance by calling org.gradle.api.Project#getTasks()
, or using the tasks
property in your build script.
abstract fun create(options: MutableMap<String, *>): Task
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: OptionDescriptionDefault Value{@value org.gradle.api.Task#TASK_NAME} The name of the task to create.None. Must be specified. {@value org.gradle.api.Task#TASK_TYPE} The class of the task to create.org.gradle.api.DefaultTask {@value org.gradle.api.Task#TASK_ACTION} The closure or Action to execute when the task executes. See Task#doFirst(Action) .null {@value org.gradle.api.Task#TASK_OVERWRITE} Replace an existing task?false {@value org.gradle.api.Task#TASK_DEPENDS_ON} The dependencies of the task. See here for more details.[] {@value org.gradle.api.Task#TASK_GROUP} The group of the task.null {@value org.gradle.api.Task#TASK_DESCRIPTION} The description of the task. null {@value org.gradle.api.Task#TASK_CONSTRUCTOR_ARGS} The arguments to pass to the task class constructor. null
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 abstract fun create(options: MutableMap<String, *>, configureClosure: Closure<Any>): Task
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 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. abstract fun create(name: String, configureClosure: Closure<Any>): Task
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. abstract fun create(name: String): Task
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. abstract fun <T : Task> create(name: String, type: Class<T>): T
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. abstract fun <T : Task> create(name: String, type: Class<T>, vararg constructorArgs: Any): T
Creates a Task with the given name and type, passing the given arguments to the 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. abstract fun <T : Task> create(name: String, type: Class<T>, configuration: Action<in T>): T
Creates a Task with the given name and type, configures it with the given action, 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. |
|
abstract fun findByPath(path: String): Task
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. |
|
abstract fun getByPath(path: String): Task
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. |
|
abstract fun register(name: String, configurationAction: Action<in Task>): TaskProvider<Task>
Defines a new task, which will be created and configured when it is required. A task is 'required' when the task is located using query methods such as It is generally more efficient to use this method instead of abstract fun <T : Task> register(name: String, type: Class<T>, configurationAction: Action<in T>): TaskProvider<T>
Defines a new task, which will be created and configured when it is required. A task is 'required' when the task is located using query methods such as It is generally more efficient to use this method instead of abstract fun <T : Task> register(name: String, type: Class<T>): TaskProvider<T>
Defines a new task, which will be created when it is required. A task is 'required' when the task is located using query methods such as It is generally more efficient to use this method instead of abstract fun <T : Task> register(name: String, type: Class<T>, vararg constructorArgs: Any): TaskProvider<T>
Defines a new task, which will be created when it is required passing the given arguments to the It is generally more efficient to use this method instead of abstract fun register(name: String): TaskProvider<Task>
Defines a new task, which will be created when it is required. A task is 'required' when the task is located using query methods such as It is generally more efficient to use this method instead of |
|
abstract fun replace(name: String): Task
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. abstract fun <T : Task> replace(name: String, type: Class<T>): T
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. |
abstract fun <U : T> containerWithType(type: Class<U>): NamedDomainObjectContainer<U>
Creates a regular container that wraps the polymorphic container presenting all elements of a specified type. |
|
abstract fun getAt(name: String): T
{@inheritDoc} |
|
abstract fun getByName(name: String, configureClosure: Closure<Any>): T abstract fun getByName(name: String): T
{@inheritDoc} |
|
abstract fun matching(spec: Spec<in T>): TaskCollection<T> abstract fun matching(closure: Closure<Any>): TaskCollection<T>
{@inheritDoc} |
|
abstract fun <U : T> maybeCreate(name: String, type: Class<U>): U
Looks for an item with the given name and type, creating and adding it to this container if it does not exist. |
|
abstract fun named(name: String): TaskProvider<T>
Locates a task by name, without triggering its creation or configuration, failing if there is no such object. |
|
abstract fun whenTaskAdded(action: Action<in T>): Action<in T>
Adds an abstract fun whenTaskAdded(closure: Closure<Any>): Unit
Adds a closure to be called when a task is added to this collection. The task is passed to the closure as the parameter. |
|
abstract fun <S : T> withType(type: Class<S>): TaskCollection<S>
{@inheritDoc} |
fun <T : Task> TaskContainer.create(name: String, vararg arguments: Any): T
Creates a Task with the given name and type, passing the given arguments to the javax.inject.Inject-annotated constructor, and adds it to this project tasks container. |