What's the right solution for making verification ...
# community-support
m
What's the right solution for making verification type tasks cacheable? My task doesn't produce any output as it just checks certain conditions being present in the build? How do I make it cacheable? Do I just make a token output item like a file I write "verification successful" to? Where do I put it then, does this make sense?
Copy code
layout.buildDirectory.file("intermediates/***/***.txt")
v
To make it up-to-dateable and cacheable you just have to tell Gradle there it is valid that there is no output by using
outputs.upToDateWhen { true }
No need for fake-outputs
m
Haven't seen this anywhere, thank you 👍🏻
👌 1
v
The least tasks without outputs are up-to-dateable or cacheable, most have at least some kind of report. 🙂
m
I am looking into using your provided solution but struggle to conceptualise this, if this task is always up-to-date once declared so, would this mean it would not be executed again on new inputs?
I guess if that's so, then it doesn't really fit my use case as my task is expected to run during compilation, checking if dependencies look good
v
if this task is always up-to-date once declared so
Why should it be? You just say that the outputs are up-to-date. That does not mean that the inputs are ignored.
👀 1
If the inputs change, the task is still rerun and also not taken from cache
m
Makes sense, thank you
👌 1