public interface TaskOutputs extends CompatibilityAdapterForTaskOutputs
A TaskOutputs
represents the outputs of a task.
You can obtain a TaskOutputs
instance using Task.getOutputs()
.
Modifier and Type | Method and Description |
---|---|
void |
cacheIf(Spec<? super Task> spec)
Cache the results of the task only if the given spec is satisfied.
|
TaskOutputFilePropertyBuilder |
dir(Object path)
Registers an output directory for this task.
|
TaskOutputFilePropertyBuilder |
file(Object path)
Registers some output file for this task.
|
TaskOutputFilePropertyBuilder |
files(Object... paths)
Registers some output files for this task.
|
FileCollection |
getFiles()
Returns the output files of this task.
|
boolean |
getHasOutput()
Returns true if this task has declared any outputs.
|
void |
upToDateWhen(Closure upToDateClosure)
Adds a predicate to determine whether the outputs of this task are up-to-date.
|
void |
upToDateWhen(Spec<? super Task> upToDateSpec)
Adds a predicate to determine whether the outputs of this task are up-to-date.
|
void upToDateWhen(Closure upToDateClosure)
Adds a predicate to determine whether the outputs of this task are up-to-date. The given closure is executed at task execution time. The closure is passed the task as a parameter. If the closure returns false, the task outputs are considered out-of-date and the task will be executed.
You can add multiple such predicates. The task outputs are considered out-of-date when any predicate returns false.
upToDateClosure
- The closure to use to determine whether the task outputs are up-to-date.void upToDateWhen(Spec<? super Task> upToDateSpec)
Adds a predicate to determine whether the outputs of this task are up-to-date. The given spec is evaluated at task execution time. If the spec returns false, the task outputs are considered out-of-date and the task will be executed.
You can add multiple such predicates. The task outputs are considered out-of-date when any predicate returns false.
upToDateSpec
- The spec to use to determine whether the task outputs are up-to-date.@Incubating void cacheIf(Spec<? super Task> spec)
Cache the results of the task only if the given spec is satisfied. The spec will be evaluated at task execution time, not during configuration. If the Spec is not satisfied, the results of the task will not be cached.
You may add multiple such predicates. The results of the task are not cached if any of the predicates return false.
spec
- specifies if the results of the task should be cached.boolean getHasOutput()
FileCollection getFiles()
TaskOutputFilePropertyBuilder files(Object... paths)
files
in interface CompatibilityAdapterForTaskOutputs
paths
- The output files. The given paths are evaluated as per Project.files(Object...)
.TaskOutputFilePropertyBuilder file(Object path)
file
in interface CompatibilityAdapterForTaskOutputs
path
- The output file. The given path is evaluated as per Project.file(Object)
.TaskOutputFilePropertyBuilder dir(Object path)
dir
in interface CompatibilityAdapterForTaskOutputs
path
- The output directory. The given path is evaluated as per Project.file(Object)
.