Movatterモバイル変換


[0]ホーム

URL:


ProviderFactory

API Documentation:ProviderFactory

A factory for creating instances ofProvider.

An instance of the factory can be injected into a task, plugin or other object by annotating a public constructor or property getter method withjavax.inject.Inject.It is also available viaProject.getProviders() andSettings.getProviders().

Properties

No properties

Methods

MethodDescription
credentials(credentialsType, identity)

Creates aProvider for the givenCredentials type.

credentials(credentialsType, identity)

Creates aProvider for the givenCredentials type.

environmentVariable(variableName)

Creates aProvider whose value is fetched from the environment variable with the given name.

environmentVariable(variableName)

Creates aProvider whose value is fetched from the environment variable with the given name.

environmentVariablesPrefixedBy(variableNamePrefix)

Creates aProvider whose value is a name-to-value map of the environment variables with the names starting with the given prefix.The prefix comparison is case-sensitive. The returned map is immutable.

environmentVariablesPrefixedBy(variableNamePrefix)

Creates aProvider whose value is a name-to-value map of the environment variables with the names starting with the given prefix.The prefix comparison is case-sensitive. The returned map is immutable.

exec(action)

Allows lazy access to the output of the external process.

fileContents(file)

Allows lazy access to the contents of the given file.

fileContents(file)

Allows lazy access to the contents of the given file.

gradlePropertiesPrefixedBy(variableNamePrefix)

Creates aProvider whose value is a name-to-value map of the Gradle properties with the names starting with the given prefix.The prefix comparison is case-sensitive. The returned map is immutable.

gradlePropertiesPrefixedBy(variableNamePrefix)

Creates aProvider whose value is a name-to-value map of the Gradle properties with the names starting with the given prefix.The prefix comparison is case-sensitive. The returned map is immutable.

gradleProperty(propertyName)

Creates aProvider whose value is fetched from the Gradle property of the given name.

gradleProperty(propertyName)

Creates aProvider whose value is fetched from the Gradle property of the given name.

javaexec(action)

Allows lazy access to the output of the external java process.

of(valueSourceType, configuration)

Creates aProvider whose value is obtained from the givenValueSource.

provider(value)

Creates aProvider whose value is calculated using the givenCallable.

systemPropertiesPrefixedBy(variableNamePrefix)

Creates aProvider whose value is a name-to-value map of the system properties with the names starting with the given prefix.The prefix comparison is case-sensitive. The returned map is immutable.

systemPropertiesPrefixedBy(variableNamePrefix)

Creates aProvider whose value is a name-to-value map of the system properties with the names starting with the given prefix.The prefix comparison is case-sensitive. The returned map is immutable.

systemProperty(propertyName)

Creates aProvider whose value is fetched from system properties using the given property name.

systemProperty(propertyName)

Creates aProvider whose value is fetched from system properties using the given property name.

zip(first, second, combiner)

Returns a provider which value will be computed by combining a provider value with anotherprovider value using the supplied combiner function.

Script blocks

No script blocks

Method details

Provider<T>credentials(Class<T> credentialsType,String identity)

Creates aProvider for the givenCredentials type.

The provider returned by this method should be attached to a task's input property.This way, the presence of credentials will be validated before any of the tasks are executed if and only if the task with credentials property is to be executed.

Values for the requested Credentials type will be sourced from the project's properties using the pattern "identity" + credentials field.For example,PasswordCredentials provider with identity "myService" will look for properties named "myServiceUsername" and "myServicePassword".

The following credential types are currently supported:

Provider<T>credentials(Class<T> credentialsType,Provider<String> identity)

Creates aProvider for the givenCredentials type.

The provider returned by this method should be attached to a task's input property.This way, the presence of credentials will be validated before any of the tasks are executed if and only if the task with credentials property is to be executed.

Values for the requested Credentials type will be sourced from the project's properties using the pattern "identity" + credentials field.For example,PasswordCredentials provider with identity "myService" will look for properties named "myServiceUsername" and "myServicePassword".

The following credential types are currently supported:

Provider<String>environmentVariable(String variableName)

Creates aProvider whose value is fetched from the environment variable with the given name.

Provider<String>environmentVariable(Provider<String> variableName)

Creates aProvider whose value is fetched from the environment variable with the given name.

Provider<Map<String,String>>environmentVariablesPrefixedBy(String variableNamePrefix)

Creates aProvider whose value is a name-to-value map of the environment variables with the names starting with the given prefix.The prefix comparison is case-sensitive. The returned map is immutable.

Provider<Map<String,String>>environmentVariablesPrefixedBy(Provider<String> variableNamePrefix)

Creates aProvider whose value is a name-to-value map of the environment variables with the names starting with the given prefix.The prefix comparison is case-sensitive. The returned map is immutable.

ExecOutputexec(Action<? superExecSpec> action)

Allows lazy access to the output of the external process.

When the process output is read at configuration time it is considered as an input to theconfiguration model. Consequent builds will re-execute the process to obtain the output andcheck if the cached model is still up-to-date.

The process input and output streams cannot be configured.

For more sophisticated use cases, like handling execution exceptions, supplying input streams or processing the output in a streaming way, useValueSource.

FileContentsfileContents(RegularFile file)

Allows lazy access to the contents of the given file.

When the file contents are read at configuration time the file is automatically consideredas an input to the configuration model.

FileContentsfileContents(Provider<RegularFile> file)

Allows lazy access to the contents of the given file.

When the file contents are read at configuration time the file is automatically consideredas an input to the configuration model.

Provider<Map<String,String>>gradlePropertiesPrefixedBy(String variableNamePrefix)

Creates aProvider whose value is a name-to-value map of the Gradle properties with the names starting with the given prefix.The prefix comparison is case-sensitive. The returned map is immutable.

Provider<Map<String,String>>gradlePropertiesPrefixedBy(Provider<String> variableNamePrefix)

Creates aProvider whose value is a name-to-value map of the Gradle properties with the names starting with the given prefix.The prefix comparison is case-sensitive. The returned map is immutable.

Provider<String>gradleProperty(String propertyName)

Creates aProvider whose value is fetched from the Gradle property of the given name.

Provider<String>gradleProperty(Provider<String> propertyName)

Creates aProvider whose value is fetched from the Gradle property of the given name.

ExecOutputjavaexec(Action<? superJavaExecSpec> action)

Allows lazy access to the output of the external java process.

When the process output is read at configuration time it is considered as an input to theconfiguration model. Consequent builds will re-execute the process to obtain the output andcheck if the cached model is still up-to-date.

The process input and output streams cannot be configured.

For more sophisticated use cases, like handling execution exceptions, supplying input streams or processing the output in a streaming way, useValueSource.

Provider<T>of(Class<? extendsValueSource<T,P>> valueSourceType,Action<? superValueSourceSpec<P>> configuration)

Creates aProvider whose value is obtained from the givenValueSource.

Provider<T>provider(Callable<? extendsT> value)

Creates aProvider whose value is calculated using the givenCallable.

The provider is live and will call theCallable each time its value is queried. TheCallable may returnnull, in which case the provider is considered to have no value.

Provider<Map<String,String>>systemPropertiesPrefixedBy(String variableNamePrefix)

Creates aProvider whose value is a name-to-value map of the system properties with the names starting with the given prefix.The prefix comparison is case-sensitive. The returned map is immutable.

Provider<Map<String,String>>systemPropertiesPrefixedBy(Provider<String> variableNamePrefix)

Creates aProvider whose value is a name-to-value map of the system properties with the names starting with the given prefix.The prefix comparison is case-sensitive. The returned map is immutable.

Provider<String>systemProperty(String propertyName)

Creates aProvider whose value is fetched from system properties using the given property name.

Provider<String>systemProperty(Provider<String> propertyName)

Creates aProvider whose value is fetched from system properties using the given property name.

Provider<R>zip(Provider<A> first,Provider<B> second,BiFunction<? superA, ? superB, ? extendsR> combiner)

Returns a provider which value will be computed by combining a provider value with anotherprovider value using the supplied combiner function.

The resulting provider will be live, so that each time it is queried, it queries both supplied providersand applies the combiner to the results. Whenever any of the providers has no value, the new providerwill also have no value and the combiner will not be called.

If the supplied providers represents a task or the output of a task, the resulting providerwill carry the dependency information.

©Gradle Inc. All rights reserved.
gradle
Careers |Privacy |Terms of Service |Contact

[8]ページ先頭

©2009-2025 Movatter.jp