public interface TaskTools
Utilities for working with tasks in a consistent manner across Gradle versions.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
ignoreEmptyDirectories(TaskInputs inputs, Object files)This is similar to putting both a SkipWhenEmpty and a org.gradle.api.tasks.IgnoreEmptyDirectories annotation on a property, but it deals with both
backwards and forward compatibility around Gradle 6.8. |
|
public void |
inputFiles(TaskInputs inputs, Object files, TaskInputFileOptions options)Configure a collection of files as a task input. |
|
public void |
inputFiles(TaskInputs inputs, Object files, PathSensitivity ps, TaskInputFileOptions options)Configure a collection of files as a task input. |
|
public void |
named(String taskName, Action<Task> configurator)Configures a task, preferably in a lazy-manner. |
<T extends DefaultTask> |
public void |
named(String taskName, Class<T> taskType, Action<T> configurator)Configures a task, preferably in a lazy-manner. |
<T extends DefaultTask> |
public void |
register(String taskName, Class<T> taskType)Configures a task, preferably in a lazy-manner. |
<T extends DefaultTask> |
public void |
register(String taskName, Class<T> taskType, Action<T> configurator)Registers a task in a lazy-manner. |
<T extends DefaultTask> |
public void |
register(String taskName, Class<T> taskType, Iterable<Object> args, Action<T> configurator)Registers a task in a lazy-manner. |
<T extends DefaultTask> |
public void |
register(String taskName, Class<T> taskType, java.util.List<Object> args)Registers a task in a lazy-manner. |
|
public Provider<? extends Task> |
taskProviderFrom(TaskContainer tasks, ProviderFactory providerFactory, Object o)Creates a basic task Provider instance from an object. |
|
public Provider<? extends Task> |
taskProviderFrom(Object o)Creates a basic task Provider instance from an object. |
|
public Provider<java.util.List<? extends Task>> |
taskize(Object taskies)Resolves a list of many objects to tasks items to a provider of tasks. |
|
public Provider<java.util.List<? extends Task>> |
taskize(Iterable<Object> taskies)Resolves a list of many objects to tasks items to a provider of tasks. |
|
public void |
whenNamed(String taskName, Action<Task> configurator)Adds a configuration for a task, for when a task is created. |
<T extends DefaultTask> |
public void |
whenNamed(String taskName, Class<T> taskType, Action<T> configurator)Adds a configuration for a task, for when a task is created. |
This is similar to putting both a SkipWhenEmpty and a
org.gradle.api.tasks.IgnoreEmptyDirectories annotation on a property, but it deals with both
backwards and forward compatibility around Gradle 6.8.
Accepts any of the following
inputs - Inputs for a specific taskfiles - File collectionsConfigure a collection of files as a task input.
inputs - The inputs for a specific task.files - The inputs for a specific task.options - Various additional options to set.
Some might be ignored, depending on the version of Gradle.Configure a collection of files as a task input.
inputs - The inputs for a specific task.files - The inputs for a specific task.ps - The PathSensitivity of the file collectionoptions - Various additional options to set.
Some might be ignored, depending on the version of Gradle.Configures a task, preferably in a lazy-manner.
On Gradle 4.9 or earlier it will use getByName internally.
taskName - Name of task to configure. Task must have been registered or configured previously.configurator - Configurating action.Configures a task, preferably in a lazy-manner.
On Gradle 4.9 or earlier it will use getByName internally.
taskName - Name of task to configure. Task must have been registered or configured previously.taskType - Type of task.configurator - Configurating action.T - Type of task.Configures a task, preferably in a lazy-manner.
On Gradle 4.9 or earlier it will use getByName internally.
taskName - Name of task to configure. Task must have been registered or configured previously.taskType - Type of task.T - Type of task.Registers a task in a lazy-manner.
On Gradle 4.9 or earlier it create the task.
taskName - Name of task to register. Task must have been registered or configured previously.taskType - Type of task.configurator - Configurating action.T - Type of task.Registers a task in a lazy-manner.
On Gradle 4.9 or earlier it create the task.
taskName - Name of task to register. Task must have been registered or configured previously.taskType - Type of task.args - C-tor arguments.configurator - Configurating action.T - Type of task.Registers a task in a lazy-manner.
On Gradle 4.9 or earlier it create the task.
taskName - Name of task to register. Task must have been registered or configured previously.taskType - Type of task.args - C-tor arguments.T - Type of task.Creates a basic task Provider instance from an object.
tasks - Override the task containerto use.providerFactory - Override the provider factory to use.o - Object to be evaluated to a task.Creates a basic task Provider instance from an object.
o - Object to be evaluated to a task.Resolves a list of many objects to tasks items to a provider of tasks.
taskies - Things that can be converted to Task or TaskProviderResolves a list of many objects to tasks items to a provider of tasks.
taskies - Things that can be converted to Task or TaskProviderAdds a configuration for a task, for when a task is created.
taskName - Name of task to configure.configurator - Configurating action.Adds a configuration for a task, for when a task is created.
taskName - Name of task to configure.taskType - Type of task.configurator - Configurating action.T - Type of task.