This message was deleted.
# configuration-cache
s
This message was deleted.
v
Create a build service that you register as operation completion listener. It gets notified after each task finished and you can get from the argument whether the task was skipped.
d
cool thanks, just to follow up with a bit more detail for folks that might also need to figure this out. The
event
parameter in
onFinish
has a
result
which you can then check what type it is to get the
skipMessage
or check other types
Copy code
override fun onFinish(event: FinishEvent) {
        val result = event.result
        if (result is TaskSkippedResult) {
            println(result.skipMessage)
        }
    }
👌 1
before I continue down this rabbit hole, is there anyway to get a
TaskState
or
TaskExecutionOutcome
from
event
or
event.result
? I'm finding myself rewriting that logic, something like
Copy code
fun OperationResult.getMessage(): String =
        when (this) {
            is TaskSkippedResult -> {
                this.skipMessage
            }
            is TaskSuccessResult -> {
                if (this.isUpToDate) {
                    TaskExecutionOutcome.UP_TO_DATE.message!!
                } else if (this.isFromCache) {
                    TaskExecutionOutcome.FROM_CACHE.message!!
                } else "idk"
            }
            else -> "idk"
        }
v
Didn't use it too often myself yet, but I think what you do is exactly what you need to do