Should a verification task be marked cachable and ...
# gradle
c
Should a verification task be marked cachable and if so should it write an artifact on failure?
v
For failure it doesn't matter regarding cacheability or up-to-dateness, as a failed task is never up to date and never cached.
If the verification task has no "external inputs" and produces file outputs, it can quite well be worth to enable caching, except if the verification task is so fast that it is faster to redo the verification than to get the result from the cache and unzip it.
If your task does not have file outputs anyway, it makes no sense to mark it cacheable as there is nothing to cache.
In that case just making it able to be up-to-date might be good if there are no external inputs, by having
outputs.upToDateWhen { true }
.
c
All of its inputs are taken through properties on the task, the task itself just verifies that an input file has a particular structure. For now I’m just writing an empty file as output just so it caches
v
You could try whether
outputs.upToDateWhen { true }
is also enough for caching as it is for up-to-dateness. But as I said, it depends on how long the verfication runs, to decide whether it is worth caching.
c
Okay perfect I’l benchmark it