Interface TaskInputs
-
public interface TaskInputsA
TaskInputsrepresents the inputs for a task.You can obtain a
TaskInputsinstance usingTask.getInputs().
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TaskInputFilePropertyBuilderdir(java.lang.Object dirPath)Registers an input directory hierarchy.TaskInputFilePropertyBuilderfile(java.lang.Object path)Registers some input file for this task.TaskInputFilePropertyBuilderfiles(java.lang.Object... paths)Registers some input files for this task.FileCollectiongetFiles()Returns the input files of this task.booleangetHasInputs()Returns true if this task has declared the inputs that it consumes.booleangetHasSourceFiles()Returns true if this task has declared that it accepts source files.java.util.Map<java.lang.String,java.lang.Object>getProperties()Returns a map of input properties for this task.FileCollectiongetSourceFiles()Returns the set of source files for this task.TaskInputsproperties(java.util.Map<java.lang.String,?> properties)Registers a set of input properties for this task.TaskInputPropertyBuilderproperty(java.lang.String name, java.lang.Object value)Registers an input property for this task.
-
-
-
Method Detail
-
getHasInputs
boolean getHasInputs()
Returns true if this task has declared the inputs that it consumes.- Returns:
- true if this task has declared any inputs.
-
getFiles
FileCollection getFiles()
Returns the input files of this task.- Returns:
- The input files. Returns an empty collection if this task has no input files.
-
files
TaskInputFilePropertyBuilder files(java.lang.Object... paths)
Registers some input files for this task.- Parameters:
paths- The input files. The given paths are evaluated as perProject.files(Object...).- Returns:
- a property builder to further configure the property.
-
file
TaskInputFilePropertyBuilder file(java.lang.Object path)
Registers some input file for this task.- Parameters:
path- The input file. The given path is evaluated as perProject.file(Object).- Returns:
- a property builder to further configure the property.
-
dir
TaskInputFilePropertyBuilder dir(java.lang.Object dirPath)
Registers an input directory hierarchy. All files found under the given directory are treated as input files for this task.An input directory hierarchy ignores empty directories by default. See
TaskInputFilePropertyBuilder.ignoreEmptyDirectories().- Parameters:
dirPath- The directory. The path is evaluated as perProject.file(Object).- Returns:
- a property builder to further configure the property.
-
getProperties
java.util.Map<java.lang.String,java.lang.Object> getProperties()
Returns a map of input properties for this task. The returned map is unmodifiable, and does not reflect further changes to the task's properties. Trying to modify the map will result in anUnsupportedOperationExceptionbeing thrown.- Returns:
- The properties.
-
property
TaskInputPropertyBuilder property(java.lang.String name, @Nullable java.lang.Object value)
Registers an input property for this task. This value is persisted when the task executes, and is compared against the property value for later invocations of the task, to determine if the task is up-to-date.
The given value must be a simple value, like a String or Integer, or serializable. For complex values, Gradle compares the serialized forms for detecting changes and the
equals()method is ignored.If the value is not known when registering the input, a
Providercan be passed instead. Gradle will then resolve the provider at the latest possible time in order to determine the actual property value.- Parameters:
name- The name of the property. Must not be null.value- The value for the property. Can be null.
-
properties
TaskInputs properties(java.util.Map<java.lang.String,?> properties)
Registers a set of input properties for this task. Seeproperty(String, Object)for details.Note: do not use the return value to chain calls. Instead always use call via
Task.getInputs().- Parameters:
properties- The properties.
-
getHasSourceFiles
boolean getHasSourceFiles()
Returns true if this task has declared that it accepts source files.- Returns:
- true if this task has source files, false if not.
-
getSourceFiles
FileCollection getSourceFiles()
Returns the set of source files for this task. These are the subset of input files which the task actually does work on. A task is skipped if it has declared it accepts source files, and this collection is empty.- Returns:
- The set of source files for this task.
-
-