task testHaHa {
doFirst {
if (true) {
A()
// tasks.named("A").get().execute()
}else {
// ...
}
}
}
task A {
doFirst {
println "A exec"
}
}
I need to determine the A task, or other tasks when performing the TESTHAHA task according to the logic judgment, but I find that it cannot be implemented.
It always reports an error. How should I modify it?
I hope that A task is a task rather than a method, because the task seems to be more in line with Gradle’s design concept.