I would like to programmatically tell gradle to return from a task, for example:
task ('SetupLibs') << {
if (sometest)
// how to tell gradle to return from this task
// because it is up-to-date
...
}
Is this possible in groovy? how?
You can use upToDateWhen(){...}
for example:
task foo() << {
outputs.upToDateWhen {
if (sometest) return true
}
}
You might want to consider simply skipping the task, assuming you truly don't want it to do anything https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:skipping_tasks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With