# invoke

operator fun <T : Any> Action<in T>.invoke(target: T)(source)

Enables function invocation syntax on Action references.

operator fun ArtifactHandler.invoke(configuration: ArtifactHandlerScope.() -> Unit)(source)

Configures the published artifacts for this project.

#### Since

5.1

operator fun <V> Callable<V>.invoke(): V(source)

Enables function invocation syntax on Callable references.

#### See also

Callable.call

inline operator fun ConfigurationContainer.invoke(configuration: Action<ConfigurationContainerScope>): ConfigurationContainer(source)

Allows the container to be configured via an augmented DSL.

#### Return

The container.

#### Since

8.4

#### Parameters

configuration

The expression to configure this container with

operator fun <D : ModuleDependency> DependencyModifier.invoke(dependency: D): D(source)
operator fun DependencyModifier.invoke(dependencyNotation: CharSequence): ExternalModuleDependency(source)
@Incubating
operator fun DependencyModifier.invoke(dependency: ProviderConvertible<out MinimalExternalModuleDependency>): Provider<out MinimalExternalModuleDependency>(source)
operator fun DependencyModifier.invoke(dependency: Provider<out ModuleDependency>): Provider<out ModuleDependency>(source)

Modifies a dependency to select the variant of the given module.

#### Since

8.0

#### See also

DependencyModifier

operator fun DependencyCollector.invoke(dependencyNotation: CharSequence)(source)

Add a dependency.

#### Since

8.6

#### Parameters

dependencyNotation

dependency to add

#### See also

DependencyFactory.create

operator fun DependencyCollector.invoke(dependencyNotation: CharSequence, configuration: Action<in ExternalModuleDependency>)(source)

Add a dependency.

#### Since

8.6

#### Parameters

dependencyNotation

dependency to add

configuration

an action to configure the dependency

#### See also

DependencyFactory.create

operator fun DependencyCollector.invoke(files: FileCollection)(source)

Add a dependency.

#### Since

8.6

#### Parameters

files

files to add as a dependency

operator fun DependencyCollector.invoke(files: FileCollection, configuration: Action<in FileCollectionDependency>)(source)

Add a dependency.

#### Since

8.6

#### Parameters

files

files to add as a dependency

configuration

an action to configure the dependency

@Incubating
operator fun DependencyCollector.invoke(externalModule: ProviderConvertible<out MinimalExternalModuleDependency>)(source)

Add a dependency.

#### Since

8.6

#### Parameters

externalModule

external module to add as a dependency

@Incubating
operator fun DependencyCollector.invoke(externalModule: ProviderConvertible<out MinimalExternalModuleDependency>, configuration: Action<in ExternalModuleDependency>)(source)

Add a dependency.

#### Since

8.6

#### Parameters

externalModule

external module to add as a dependency

configuration

an action to configure the dependency

operator fun DependencyCollector.invoke(dependency: Dependency)(source)
operator fun DependencyCollector.invoke(dependency: Provider<out Dependency>)(source)

Add a dependency.

#### Since

8.6

#### Parameters

dependency

dependency to add

operator fun <D : Dependency> DependencyCollector.invoke(dependency: D, configuration: Action<in D>)(source)
operator fun <D : Dependency> DependencyCollector.invoke(dependency: Provider<out D>, configuration: Action<in D>)(source)

Add a dependency.

#### Since

8.6

#### Parameters

dependency

dependency to add

configuration

an action to configure the dependency

operator fun DependencyCollector.invoke(dependencyConstraint: DependencyConstraint)(source)
@JvmName(name = "invokeConstraint")
operator fun DependencyCollector.invoke(dependencyConstraint: Provider<out DependencyConstraint>)(source)

Add a dependency constraint.

#### Since

8.7

#### Parameters

dependencyConstraint

dependency constraint to add

operator fun DependencyCollector.invoke(dependencyConstraint: DependencyConstraint, configuration: Action<in DependencyConstraint>)(source)
@JvmName(name = "invokeConstraint")
operator fun DependencyCollector.invoke(dependencyConstraint: Provider<out DependencyConstraint>, configuration: Action<in DependencyConstraint>)(source)

Add a dependency constraint.

#### Since

8.7

#### Parameters

dependencyConstraint

dependency constraint to add

configuration

an action to configure the dependency constraint

operator fun DependencyConstraintHandler.invoke(configuration: DependencyConstraintHandlerScope.() -> Unit)(source)

Configures the dependency constraints.

#### Since

5.0

operator fun <T> Closure<T>.invoke(): T(source)
operator fun <T> Closure<T>.invoke(x: Any?): T(source)
operator fun <T> Closure<T>.invoke(vararg xs: Any?): T(source)

Enables function invocation syntax on Closure references.

inline operator fun <T : Any, C : NamedDomainObjectContainer<T>> C.invoke(configuration: Action<NamedDomainObjectContainerScope<T>>): C(source)

Allows the container to be configured via an augmented DSL.

#### Return

The container.

#### Parameters

configuration

The expression to configure this container with

operator fun <T : Any> NamedDomainObjectProvider<T>.invoke(action: T.() -> Unit)(source)

Allows a NamedDomainObjectProvider to be configured via invocation syntax.

    val rebuild by tasks.registering
    rebuild { // rebuild.configure {
      dependsOn("clean")
    }

Content copied to clipboard

operator fun <T> Spec<T>.invoke(arg: T): Boolean(source)

Enables function invocation syntax on Spec instances.

#### See also

Spec.isSatisfiedBy

inline operator fun TaskContainer.invoke(configuration: TaskContainerScope.() -> Unit): TaskContainer(source)

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

    tasks {
        "build" {
            dependsOn("clean")
        }
        "clean"(Delete::class) {
            delete("./build")
        }
    }

Content copied to clipboard

#### Return

The given TaskContainer.

#### Parameters

configuration

The expression to configure this TaskContainer with.

inline operator fun <T> ExtraPropertiesExtension.invoke(initialValueProvider: () -> T): InitialValueExtraPropertyDelegateProvider<T>(source)

### Deprecated

Use 'extra.set(name, value)' instead. See the Gradle 9.6 upgrading guide.

Returns a property delegate provider that will initialize the extra property to the value provided by initialValueProvider.

Usage: `val answer by extra { 42 }`

operator fun <T> ExtraPropertiesExtension.invoke(initialValue: T): InitialValueExtraPropertyDelegateProvider<T>(source)

### Deprecated

Use 'extra.set(name, value)' instead. See the Gradle 9.6 upgrading guide.

Returns a property delegate provider that will initialize the extra property to the given initialValue.

Usage: `val answer by extra(42)`