upToDateWhen

abstract fun upToDateWhen(upToDateClosure: Closure)(source)

Adds a predicate to determine whether previous outputs of this task can be reused. The given closure is executed at task execution time. The closure is passed the task as a parameter. If the closure returns false, previous outputs of this task cannot be reused and the task will be executed. That means the task is out-of-date and no outputs will be loaded from the build cache.

You can add multiple such predicates. The task outputs cannot be reused 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>)(source)

Adds a predicate to determine whether previous outputs of this task can be reused. The given spec is evaluated at task execution time. If the spec returns false, previous outputs of this task cannot be reused and the task will be executed. That means the task is out-of-date and no outputs will be loaded from the build cache.

You can add multiple such predicates. The task outputs cannot be reused when any predicate returns false.

Parameters

upToDateSpec

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