api / org.gradle.api.tasks / TaskCollection

TaskCollection

interface TaskCollection<T : Task> : NamedDomainObjectSet<T>

A TaskCollection contains a set of Task instances, and provides a number of query methods.

Parameters

- The type of tasks which this collection contains.

Functions

getAt

abstract fun getAt(name: String): T

{@inheritDoc}

getByName

abstract fun getByName(name: String, configureClosure: Closure<Any>): T
abstract fun getByName(name: String): T

{@inheritDoc}

matching

abstract fun matching(spec: Spec<in T>): TaskCollection<T>
abstract fun matching(closure: Closure<Any>): TaskCollection<T>

{@inheritDoc}

named

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.

whenTaskAdded

abstract fun whenTaskAdded(action: Action<in T>): Action<in T>

Adds an Action to be executed when a task is added to this collection.

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.

withType

abstract fun <S : T> withType(type: Class<S>): TaskCollection<S>

{@inheritDoc}

Inherited Functions

findAll

abstract fun findAll(spec: Closure<Any>): MutableSet<T>

{@inheritDoc}

Inheritors

TaskContainer

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.