# ProviderFactory

@NonExtensible
@ServiceScope(value = Build::class)
interface ProviderFactory

A factory for creating instances of Provider.

An instance of the factory can be injected into a task, plugin or other object by annotating a public constructor or property getter method with `javax.inject.Inject`. It is also available via getProviders and getProviders.

#### Since

4.0

## Functions

credentials
Link copied to clipboard
abstract fun <T : Credentials?> credentials(credentialsType: Class<T>, identity: String): Provider<T>
abstract fun <T : Credentials?> credentials(credentialsType: Class<T>, identity: Provider<String>): Provider<T>
Creates a Provider for the given Credentials type.
credentials
Link copied to clipboard
inline fun <T : Credentials> ProviderFactory.credentials(credentialsType: KClass<T>, identity: String): Provider<T>
inline fun <T : Credentials> ProviderFactory.credentials(credentialsType: KClass<T>, identity: Provider<String>): Provider<T>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.provider.ProviderFactory.credentials.

environmentVariable
Link copied to clipboard
abstract fun environmentVariable(variableName: String): Provider<String>
abstract fun environmentVariable(variableName: Provider<String>): Provider<String>
Creates a Provider whose value is fetched from the environment variable with the given name.
environmentVariablesPrefixedBy
Link copied to clipboard
abstract fun environmentVariablesPrefixedBy(variableNamePrefix: String): Provider<Map<String, String>>
abstract fun environmentVariablesPrefixedBy(variableNamePrefix: Provider<String>): Provider<Map<String, String>>
Creates a Provider whose value is a name-to-value map of the environment variables with the names starting with the given prefix.
exec
Link copied to clipboard
abstract fun exec(action: Action<in ExecSpec>): ExecOutput
Allows lazy access to the output of the external process.
fileContents
Link copied to clipboard
abstract fun fileContents(file: RegularFile): FileContents
abstract fun fileContents(file: Provider<RegularFile>): FileContents
Allows lazy access to the contents of the given file.
gradlePropertiesPrefixedBy
Link copied to clipboard
abstract fun gradlePropertiesPrefixedBy(propertyNamePrefix: String): Provider<Map<String, String>>
abstract fun gradlePropertiesPrefixedBy(propertyNamePrefix: Provider<String>): Provider<Map<String, String>>
Creates a Provider whose value is a name-to-value map of the Gradle properties with the names starting with the given prefix.
gradleProperty
Link copied to clipboard
abstract fun gradleProperty(propertyName: String): Provider<String>
abstract fun gradleProperty(propertyName: Provider<String>): Provider<String>
Creates a Provider whose value is fetched from the Gradle property of the given name.
javaexec
Link copied to clipboard
abstract fun javaexec(action: Action<in JavaExecSpec>): ExecOutput
Allows lazy access to the output of the external java process.
of
Link copied to clipboard
abstract fun <T, P : ValueSourceParameters?> of(valueSourceType: Class<out ValueSource<T, P>>, configuration: Action<in ValueSourceSpec<P>>): Provider<T>
Creates a Provider whose value is obtained from the given ValueSource.
of
Link copied to clipboard
inline fun <T : Any, P : ValueSourceParameters> ProviderFactory.of(valueSourceType: KClass<out ValueSource<T, P>>, configuration: Action<in ValueSourceSpec<P>>): Provider<T>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.provider.ProviderFactory.of.

provider
Link copied to clipboard
abstract fun <T> provider(value: Callable<out @Nullable T>): Provider<T>
Creates a Provider whose value is calculated using the given Callable.
systemPropertiesPrefixedBy
Link copied to clipboard
abstract fun systemPropertiesPrefixedBy(variableNamePrefix: String): Provider<Map<String, String>>
abstract fun systemPropertiesPrefixedBy(variableNamePrefix: Provider<String>): Provider<Map<String, String>>
Creates a Provider whose value is a name-to-value map of the system properties with the names starting with the given prefix.
systemProperty
Link copied to clipboard
abstract fun systemProperty(propertyName: String): Provider<String>
abstract fun systemProperty(propertyName: Provider<String>): Provider<String>
Creates a Provider whose value is fetched from system properties using the given property name.
zip
Link copied to clipboard
abstract fun <A, B, R> zip(first: Provider<A>, second: Provider<B>, combiner: BiFunction<in A, in B, out R>): Provider<R>
Returns a provider which value will be computed by combining a provider value with another provider value using the supplied combiner function.