# TaskContainerScope

class TaskContainerScope : TaskContainerDelegate(source)

Receiver for the `tasks` block providing an extended set of operators for the configuration of tasks.

#### Since

4.10

## Types

Companion
Link copied to clipboard
object Companion

## Properties

asMap
Link copied to clipboard
open val asMap: SortedMap<String, Task>
collectionSchema
Link copied to clipboard
open val collectionSchema: NamedDomainObjectCollectionSchema
container
Link copied to clipboard
val container: TaskContainer
creating
Link copied to clipboard
val <T : Any> NamedDomainObjectContainer<T>.creating: NamedDomainObjectContainerCreatingDelegateProvider<T>

Provides a property delegate that creates elements of the default collection type.

val TaskContainer. creating: NamedDomainObjectContainerCreatingDelegateProvider<Task?>

Provides a property delegate that creates tasks of the default type.

delegate
Link copied to clipboard
open override val delegate: TaskContainer
elements
Link copied to clipboard
open val elements: Provider<out Collection<Task>>
namer
Link copied to clipboard
open val namer: Namer<Task>
names
Link copied to clipboard
open val names: SortedSet<String>
rules
Link copied to clipboard
open val rules: MutableList<Rule>
size
Link copied to clipboard
open override val size: Int

## Functions

add
Link copied to clipboard
open override fun add(element: Task): Boolean
addAll
Link copied to clipboard
open override fun addAll(elements: Collection<Task>): Boolean
addAllLater
Link copied to clipboard
open override fun addAllLater(provider: Provider<out Iterable<Task>>)
addLater
Link copied to clipboard
open override fun addLater(provider: Provider<out Task>)
addRule
Link copied to clipboard
open override fun addRule(rule: Rule): Rule
open override fun addRule(description: String, ruleAction: Closure<Any>): Rule
open override fun addRule(description: String, ruleAction: Action<String>): Rule
all
Link copied to clipboard
open override fun all(action: Closure<Any>)
open override fun all(action: Action<in Task>)
clear
Link copied to clipboard
open override fun clear()
configure
Link copied to clipboard
open override fun configure(configureClosure: Closure<Any>): NamedDomainObjectContainer<Task>
configureEach
Link copied to clipboard
open override fun configureEach(action: Action<in Task>)
containerWithType
Link copied to clipboard
open override fun <U : Task> containerWithType(type: Class<U>): NamedDomainObjectContainer<U>
containerWithType
Link copied to clipboard
inline fun <U : T, T : Any> PolymorphicDomainObjectContainer<T>.containerWithType(type: KClass<U>): NamedDomainObjectContainer<U>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.PolymorphicDomainObjectContainer.containerWithType.

contains
Link copied to clipboard
open operator override fun contains(element: Task): Boolean
containsAll
Link copied to clipboard
open override fun containsAll(elements: Collection<Task>): Boolean
create
Link copied to clipboard
open override fun create(name: String): Task
open override fun create(options: Map<String, *>): Task
open override fun create(name: String, configureClosure: Closure<Any>): Task
open override fun <T : Task> create(name: String, type: Class<T>): T
open override fun create(name: String, configureAction: Action<in Task>): Task
open override fun create(options: Map<String, *>, configureClosure: Closure<Any>): Task
open override fun <T : Task> create(name: String, type: Class<T>, configuration: Action<in T>): T
open override fun <T : Task> create(name: String, type: Class<T>, vararg constructorArgs: Any): T
create
Link copied to clipboard
inline fun <U : Any> PolymorphicDomainObjectContainer<in U>.create(name: String): U?

Creates a domain object with the specified name and type, and adds it to the container.

inline fun TaskContainer. create(vararg options: Pair<String, Any>): Task

Kotlin extension function for org.gradle.api.tasks.TaskContainer.create.

inline fun <U : Any> PolymorphicDomainObjectContainer<in U>.create(name: String, noinline configuration: U.() -> Unit): U?

Creates a domain object with the specified name and type, adds it to the container, and configures it with the specified action.

inline fun <U : T, T : Any> PolymorphicDomainObjectContainer<T>.create(name: String, type: KClass<U>): U
inline fun <U : T, T : Any> PolymorphicDomainObjectContainer<T>.create(name: String, type: KClass<U>, configuration: Action<in U>): U

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.PolymorphicDomainObjectContainer.create.

inline fun <T : Task> TaskContainer. create(name: String, noinline configureAction: T.() -> Unit): T

Creates a Task with the specified name and type, adds it to the container, and configures it with the specified action.

inline fun <T : Task> TaskContainer. create(name: String, type: KClass<T>): T
inline fun <T : Task> TaskContainer. create(name: String, type: KClass<T>, configuration: Action<in T>): T
inline fun <T : Task> TaskContainer. create(name: String, type: KClass<T>, vararg constructorArgs: Any): T

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.tasks.TaskContainer.create.

inline 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.

creating
Link copied to clipboard
fun <T : Any> NamedDomainObjectContainer<T>.creating(configuration: T.() -> Unit): NamedDomainObjectContainerCreatingDelegateProvider<T>

Provides a property delegate that creates elements of the default collection type with the given configuration.

fun <T : Any, U : T> PolymorphicDomainObjectContainer<T>.creating(type: KClass<U>): PolymorphicDomainObjectContainerCreatingDelegateProvider<T, U>

Provides a property delegate that creates elements of the given type.

fun TaskContainer. creating(configuration: Task.() -> Unit): NamedDomainObjectContainerCreatingDelegateProvider<Task?>

Provides a property delegate that creates tasks of the default type with the given configuration.

fun <U : Task> TaskContainer. creating(type: KClass<U>): PolymorphicDomainObjectContainerCreatingDelegateProvider<Task?, U>

Provides a property delegate that creates tasks of the given type.

fun <T : Any, U : T> PolymorphicDomainObjectContainer<T>.creating(type: Class<U>, configuration: U.() -> Unit): PolymorphicDomainObjectContainerCreatingDelegateProvider<T, U>

Provides a property delegate that creates elements of the given type expressed as a java.lang.Class with the given configuration.

fun <T : Any, U : T> PolymorphicDomainObjectContainer<T>.creating(type: KClass<U>, configuration: U.() -> Unit): PolymorphicDomainObjectContainerCreatingDelegateProvider<T, U>

Provides a property delegate that creates elements of the given type with the given configuration.

fun <U : Task> TaskContainer. creating(type: Class<U>, configuration: U.() -> Unit): PolymorphicDomainObjectContainerCreatingDelegateProvider<Task?, U>?

Provides a property delegate that creates tasks of the given type expressed as a java.lang.Class with the given configuration.

fun <U : Task> TaskContainer. creating(type: KClass<U>, configuration: U.() -> Unit): PolymorphicDomainObjectContainerCreatingDelegateProvider<Task?, U>?

Provides a property delegate that creates tasks of the given type with the given configuration.

disallowChanges
Link copied to clipboard
@Incubating
open fun disallowChanges()

Disallows further structural modifications to this collection.

findAll
Link copied to clipboard
open override fun findAll(spec: Closure<Any>): MutableSet<Task>
findByName
Link copied to clipboard
open override fun findByName(name: String): Task?
findByPath
Link copied to clipboard
open override fun findByPath(path: String): Task?
get
Link copied to clipboard
operator fun <T : Any> NamedDomainObjectCollection<T>.get(name: String): T

Locates an object by name, failing if there is no such object.

getAsMap
Link copied to clipboard
open override fun getAsMap(): SortedMap<String, Task>
getAt
Link copied to clipboard
open override fun getAt(name: String): Task
getByName
Link copied to clipboard
open override fun getByName(name: String): Task
open override fun getByName(name: String, configureClosure: Closure<Any>): Task
open override fun getByName(name: String, configureAction: Action<in Task>): Task
getByName
Link copied to clipboard
inline fun <T : Any> NamedDomainObjectCollection<out Any>.getByName(name: String): T

Locates an object by name and casts it to the expected type T.

inline fun <T : Any> NamedDomainObjectCollection<out Any>.getByName(name: String, configure: T.() -> Unit): T

Locates an object by name and casts it to the expected type T then configures it.

fun <T : Any> NamedDomainObjectCollection<out Any>.getByName(name: String, type: KClass<T>): T

Locates an object by name and casts it to the expected type.

fun <T : Any> NamedDomainObjectCollection<out Any>.getByName(name: String, type: KClass<T>, configure: T.() -> Unit): T

Locates an object by name and casts it to the expected type then configures it.

getByPath
Link copied to clipboard
open override fun getByPath(path: String): Task
getCollectionSchema
Link copied to clipboard
open override fun getCollectionSchema(): NamedDomainObjectCollectionSchema
getElements
Link copied to clipboard
open override fun getElements(): Provider<out Collection<Task>>
getNamer
Link copied to clipboard
open override fun getNamer(): Namer<Task>
getNames
Link copied to clipboard
open override fun getNames(): SortedSet<String>
getRules
Link copied to clipboard
open override fun getRules(): MutableList<Rule>
getting
Link copied to clipboard
fun <T : Any, U : T> NamedDomainObjectContainer<T>.getting(type: KClass<U>): PolymorphicDomainObjectContainerGettingDelegateProvider<T, U>

Provides a property delegate that gets elements of the given type.

fun <T : Any, U : T> NamedDomainObjectContainer<T>.getting(type: KClass<U>, configuration: U.() -> Unit): PolymorphicDomainObjectContainerGettingDelegateProvider<T, U>

Provides a property delegate that gets elements of the given type and applies the given configuration.

invoke
Link copied to clipboard
operator fun String. invoke(configuration: Task.() -> Unit): TaskProvider<Task>
operator fun <U : Task> String. invoke(type: KClass<U>, configuration: U.() -> Unit): TaskProvider<U>

Configures a task by name, without triggering its creation or configuration, failing if there is no such task.

operator fun <U : Task> String. invoke(type: KClass<U>): TaskProvider<U>

Locates a task by name and type, without triggering its creation or configuration, failing if there is no such task.

invoke
Link copied to clipboard
inline operator fun TaskContainer. invoke(configuration: TaskContainerScope.() -> Unit): TaskContainer

Allows a TaskContainer to be configured via an augmented DSL that includes a shorthand string notation for configuring existing tasks.

isEmpty
Link copied to clipboard
open override fun isEmpty(): Boolean
iterator
Link copied to clipboard
open operator override fun iterator(): MutableIterator<Task>
matching
Link copied to clipboard
open override fun matching(closure: Closure<Any>): TaskCollection<Task>
open override fun matching(spec: Spec<in Task>): TaskCollection<Task>
maybeCreate
Link copied to clipboard
open override fun maybeCreate(name: String): Task
open override fun <U : Task> maybeCreate(name: String, type: Class<U>): U
maybeCreate
Link copied to clipboard
inline fun <U : Any> PolymorphicDomainObjectContainer<in U>.maybeCreate(name: String): U?

Creates a domain object with the specified name and type if it does not exists, and adds it to the container.

inline fun <U : T, T : Any> PolymorphicDomainObjectContainer<T>.maybeCreate(name: String, type: KClass<U>): U

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.PolymorphicDomainObjectContainer.maybeCreate.

named
Link copied to clipboard
open override fun named(name: String): TaskProvider<Task>
open override fun named(predicate: Spec<String>): TaskCollection<Task>
open override fun <S : Task> named(name: String, type: Class<S>): TaskProvider<S>
open override fun named(name: String, configurationAction: Action<in Task>): TaskProvider<Task>
open override fun <S : Task> named(name: String, type: Class<S>, configurationAction: Action<in S>): TaskProvider<S>
named
Link copied to clipboard
inline fun <T : Any> NamedDomainObjectCollection<out Any>.named(name: String): NamedDomainObjectProvider<T>
fun <T : Any> NamedDomainObjectCollection<out Any>.named(name: String, type: KClass<T>): NamedDomainObjectProvider<T>

Locates an object by name and type, without triggering its creation or configuration, failing if there is no such object.

inline fun <T : Task> TaskCollection<out Task>.named(name: String): TaskProvider<T>
fun <T : Task> TaskCollection<out Task>.named(name: String, type: KClass<T>): TaskProvider<T>

Locates a task by name and type, without triggering its creation or configuration, failing if there is no such task.

inline fun <S : T, T : Any> NamedDomainObjectCollection<T>.named(name: String, type: KClass<S>): NamedDomainObjectProvider<S>
inline fun <S : T, T : Any> NamedDomainObjectCollection<T>.named(name: String, type: KClass<S>, configurationAction: Action<in S>): NamedDomainObjectProvider<S>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.NamedDomainObjectCollection.named.

inline fun <T : Any> NamedDomainObjectCollection<out Any>.named(name: String, noinline configuration: T.() -> Unit): NamedDomainObjectProvider<T>
fun <T : Any> NamedDomainObjectCollection<out Any>.named(name: String, type: KClass<T>, configuration: T.() -> Unit): NamedDomainObjectProvider<T>

Configures an object by name and type, without triggering its creation or configuration, failing if there is no such object.

inline fun <S : T, T : Task> TaskCollection<T>.named(name: String, type: KClass<S>): TaskProvider<S>
inline fun <S : T, T : Task> TaskCollection<T>.named(name: String, type: KClass<S>, configurationAction: Action<in S>): TaskProvider<S>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.tasks.TaskCollection.named.

inline fun <T : Task> TaskCollection<out Task>.named(name: String, noinline configuration: T.() -> Unit): TaskProvider<T>
fun <T : Task> TaskCollection<out Task>.named(name: String, type: KClass<T>, configuration: T.() -> Unit): TaskProvider<T>

Configures a task by name and type, without triggering its creation or configuration, failing if there is no such task.

provideDelegate
Link copied to clipboard
operator fun <T : Any> NamedDomainObjectCollection<T>.provideDelegate(thisRef: Any?, property: KProperty<*>): NamedDomainObjectProvider<T?>?

Allows a NamedDomainObjectCollection to be used as a property delegate.

register
Link copied to clipboard
open override fun register(name: String): TaskProvider<Task>
open override fun <T : Task> register(name: String, type: Class<T>): TaskProvider<T>
open override fun register(name: String, configurationAction: Action<in Task>): TaskProvider<Task>
open override fun <T : Task> register(name: String, type: Class<T>, configurationAction: Action<in T>): TaskProvider<T>
open override fun <T : Task> register(name: String, type: Class<T>, vararg constructorArgs: Any): TaskProvider<T>
register
Link copied to clipboard
inline fun <T : Any> PolymorphicDomainObjectContainer<in T>.register(name: String): NamedDomainObjectProvider<T>

Defines a new object, which will be created when it is required.

inline fun <T : Task> TaskContainer. register(name: String): TaskProvider<T>

Defines a new task, which will be created when it is required.

inline fun <T : Any> PolymorphicDomainObjectContainer<in T>.register(name: String, noinline configuration: T.() -> Unit): NamedDomainObjectProvider<T>

Defines and configure a new object, which will be created when it is required.

inline fun <U : T, T : Any> PolymorphicDomainObjectContainer<T>.register(name: String, type: KClass<U>): NamedDomainObjectProvider<U>
inline fun <U : T, T : Any> PolymorphicDomainObjectContainer<T>.register(name: String, type: KClass<U>, configurationAction: Action<in U>): NamedDomainObjectProvider<U>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.PolymorphicDomainObjectContainer.register.

inline fun <T : Task> TaskContainer. register(name: String, noinline configuration: T.() -> Unit): TaskProvider<T>

Defines and configure a new task, which will be created when it is required.

inline fun <T : Task> TaskContainer. register(name: String, type: KClass<T>): TaskProvider<T>
inline fun <T : Task> TaskContainer. register(name: String, type: KClass<T>, configurationAction: Action<in T>): TaskProvider<T>
inline fun <T : Task> TaskContainer. register(name: String, type: KClass<T>, vararg constructorArgs: Any): TaskProvider<T>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.tasks.TaskContainer.register.

inline fun <T : Task> TaskContainer. register(name: String, vararg arguments: Any): TaskProvider<T>

Defines a new task, which will be created when it is required passing the given arguments to the javax.inject.Inject-annotated constructor.

remove
Link copied to clipboard
open override fun remove(element: Task): Boolean
removeAll
Link copied to clipboard
open override fun removeAll(elements: Collection<Task>): Boolean
replace
Link copied to clipboard
open override fun replace(name: String): Task
open override fun <T : Task> replace(name: String, type: Class<T>): T
replace
Link copied to clipboard
inline fun <T : Task> TaskContainer. replace(name: String, type: KClass<T>): T

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.tasks.TaskContainer.replace.

retainAll
Link copied to clipboard
open override fun retainAll(elements: Collection<Task>): Boolean
whenObjectAdded
Link copied to clipboard
open override fun whenObjectAdded(action: Closure<Any>)
open override fun whenObjectAdded(action: Action<in Task>): Action<in Task>
whenObjectRemoved
Link copied to clipboard
open override fun whenObjectRemoved(action: Closure<Any>)
open override fun whenObjectRemoved(action: Action<in Task>): Action<in Task>
whenTaskAdded
Link copied to clipboard
open override fun whenTaskAdded(closure: Closure<Any>)
open override fun whenTaskAdded(action: Action<in Task>): Action<in Task>
withType
Link copied to clipboard
open override fun <S : Task> withType(type: Class<S>): TaskCollection<S>
open override fun <S : Task> withType(type: Class<S>, configureClosure: Closure<Any>): DomainObjectCollection<S>
open override fun <S : Task> withType(type: Class<S>, configureAction: Action<in S>): DomainObjectCollection<S>
withType
Link copied to clipboard
inline fun <S : Any> DomainObjectCollection<in S>.withType(): DomainObjectCollection<S?>?
inline fun <S : Any> NamedDomainObjectCollection<in S>.withType(): NamedDomainObjectCollection<S>
inline fun <S : Task> TaskCollection<in S>.withType(): TaskCollection<S>

Returns a collection containing the objects in this collection of the given type. The returned collection is live, so that when matching objects are later added to this collection, they are also visible in the filtered collection.

inline fun <S : Any> DomainObjectCollection<in S>.withType(noinline configuration: S.() -> Unit): DomainObjectCollection<S?>?

Returns a collection containing the objects in this collection of the given type. Equivalent to calling `withType(type).all(configureAction)`.

inline fun <S : T, T : Any> DomainObjectCollection<T>.withType(type: KClass<S>): DomainObjectCollection<S>
inline fun <S : T, T : Any> DomainObjectCollection<T>.withType(type: KClass<S>, configureAction: Action<in S>): DomainObjectCollection<S>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.DomainObjectCollection.withType.

inline fun <S : T, T : Any> DomainObjectSet<T>.withType(type: KClass<S>): DomainObjectSet<S>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.DomainObjectSet.withType.

inline fun <S : T, T : Any> NamedDomainObjectCollection<T>.withType(type: KClass<S>): NamedDomainObjectCollection<S>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.NamedDomainObjectCollection.withType.

inline fun <S : T, T : Any> NamedDomainObjectSet<T>.withType(type: KClass<S>): NamedDomainObjectSet<S>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.NamedDomainObjectSet.withType.

inline fun <S : T, T : Task> TaskCollection<T>.withType(type: KClass<S>): TaskCollection<S>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.tasks.TaskCollection.withType.