Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## org.gradle.api.tasks
[Java] Interface TaskOutputs

    public interface TaskOutputs

A `TaskOutputs` represents the outputs of a task.

You can obtain a `TaskOutputs` instance using Task.getOutputs.

Method Summary
`TaskOutputs` | `dir(java.lang.Object path)` Registers an output directory for this task.
`TaskOutputs` | `file(java.lang.Object path)` Registers some output file for this task.
`TaskOutputs` | `files(java.lang.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(groovy.lang.Closure upToDateClosure)` Adds a predicate to determine whether the outputs of this task are up-to-date.
`void` | `upToDateWhen(Spec upToDateSpec)` Adds a predicate to determine whether the outputs of this task are up-to-date.

Method Detail

### dir

    public TaskOutputs dir(java.lang.Object path)

  Registers an output directory for this task.
  Parameters:
    `path` - The output directory. The given path is evaluated as for Project.file.
  Returns:
    this

### file

    public TaskOutputs file(java.lang.Object path)

  Registers some output file for this task.
  Parameters:
    `path` - The output file. The given path is evaluated as for Project.file.
  Returns:
    this

### files

    public TaskOutputs files(java.lang.Object paths)

  Registers some output files for this task.
  Parameters:
    `paths` - The output files. The given paths are evaluated as for Project.files.
  Returns:
    this

### getFiles

    public FileCollection getFiles()

  Returns the output files of this task.
  Returns:
    The output files. Returns an empty collection if this task has no output files.

### getHasOutput

    public boolean getHasOutput()

  Returns true if this task has declared any outputs. Note that a task may be able to produce output files and still have an empty set of output files.
  Returns:
    true if this task has declared any outputs, otherwise false.

### upToDateWhen

    public void upToDateWhen(groovy.lang.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 executed.

  You can add multiple such predicates. The task outputs are considered out-of-date when any predicate returns false.

  Parameters:
    `upToDateClosure` - The closure to use to determine whether the task outputs are up-to-date.

### upToDateWhen

    public void upToDateWhen(Spec 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.

  Parameters:
    `upToDateSpec` - The spec to use to determine whether the task outputs are up-to-date.

Groovy Documentation