api / org.gradle.api.tasks / TaskOutputs / upToDateWhen

upToDateWhen

abstract fun upToDateWhen(upToDateClosure: Closure<Any>): Unit

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.

Parameters

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

abstract fun upToDateWhen(upToDateSpec: Spec<in Task>): Unit

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.