I want to ask how I can make a custom task in gradle for continious build, which do something and returns boolean
class MyTask extends DefaultTask {
@InputFile
File first
@InputFile
File second
@TaskAction
boolean check() {
return ..
}
}
So when I call my task in the build script I want to check if the return value is true or false and to do something. Is this poslible to be done and if yes how if not how to do it another way?
task myCheckTAsk(type: MyTask) {
...???
}
I want to put my logic in separate groovy class because my build.gradle file will become very long and hard to read.
Task actions can't return a value, but they can assign a value to a property of the task, and later tasks can read that value. Note that you should never call a task action yourself; it's up to Gradle to do so.
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