# Interface TaskState

public interface TaskState
`TaskState` provides information about the execution state of a `Task`. You can obtain a `TaskState` instance by calling `Task.getState()`.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`getDidWork()`
Checks if the task actually did any work.
`boolean`
`getExecuted()`
Returns true if this task has been executed.
`Throwable`
`getFailure()`
Returns the exception describing the task failure, if any.
`boolean`
`getNoSource()`
Returns true if the execution of this task was skipped due to task inputs are empty.
`String`
`getSkipMessage()`
Returns a message describing why the task was skipped.
`boolean`
`getSkipped()`
Returns true if the execution of this task was skipped for some reason.
`boolean`
`getUpToDate()`
Returns true if the execution of this task was skipped because the task was up-to-date.
`void`
`rethrowFailure()`
Throws the task failure, if any.

## Method Details

### getExecuted

boolean getExecuted()

Returns true if this task has been executed.

Returns:
  true if this task has been executed.

### getFailure

@Nullable Throwable getFailure()
Returns the exception describing the task failure, if any.

Returns:
  The exception, or null if the task did not fail.

### rethrowFailure

void rethrowFailure()
Throws the task failure, if any. Does nothing if the task did not fail.

### getDidWork

boolean getDidWork()

Checks if the task actually did any work. Even if a task executes, it may determine that it has nothing to do. For example, a compilation task may determine that source files have not changed since the last time a the task was run.

Returns:
  true if this task has been executed and did any work.

### getSkipped

boolean getSkipped()
Returns true if the execution of this task was skipped for some reason.

Returns:
  true if this task has been executed and skipped.

### getSkipMessage

@Nullable String getSkipMessage()
Returns a message describing why the task was skipped.

Returns:
  the message. returns null if the task was not skipped.

### getUpToDate

@Incubating boolean getUpToDate()
Returns true if the execution of this task was skipped because the task was up-to-date.

Returns:
  true if this task has been considered up-to-date
Since:
  2.5

### getNoSource

@Incubating boolean getNoSource()
Returns true if the execution of this task was skipped due to task inputs are empty.

Returns:
  true if this task has no input files assigned
Since:
  3.4