Is there something about the evaluation of the output for UP-TO-DATEness that I’m simply not understanding? Presumably there is something about the output of the funcTestTask that triggers a rerun, but even with the same output files the server doesn’t run again.
What you have to understand is that during the first run, when the tasks failed, the funcTestTask didn’t complete, so it didn’t snapshot the outputs. ServerRun DID complete, so it did snapshot its outputs. So on the second run, the inputs/outputs for serverRun haven’t changed, so it happily skips it while the outputs aren’t cached for funcTestTask and so it must re-run it.
You might be able to do something clever with a task listener and a trigger file. So, serverRun has the trigger file as an input and you only change it if the test task fails:
serverRun {
ext.trigger = file("${buildDir}/trigger")
inputs.files trigger
}
gradle.taskGraph.afterTask { Task task, TaskState state ->
if (task.name == "funcTestTask" && state.failure) {
serverRun.trigger << new Date()
}
}
I haven’t really thought this through, and there might be some pathological cases here (i.e. use at your own risk), but that might give you something to work with.