Current Behavior
Let's imagine we have two tasks:
and we have declared that task("a") { finalizedBy("b") }.
If we cancel the build (CTRL-C in the CLI, stop button in IDEA) while a is running, both a and b are marked as cancelled.
Expected Behavior
a should be cancelled, but b should run anyway.
Context (optional)
Finalizer tasks are useful in situations where the build creates a resource that has to be cleaned up regardless of the build failing or succeeding. An example of such a resource is a web container that is started before an integration test task and which should be always shut down, even if some of the tests fail.
https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:finalizer_tasks
I would expect that long-running tasks that start servers would fall under the same use-case, and thus would also need to be finalized even if they are cancelled before finishing.
Steps to Reproduce
// build.gradle.kts
val a by tasks.registering {
doLast {
Thread.sleep(10000)
}
finalizedBy(b)
}
val b by tasks.registering {
doLast {
println("Ran")
}
}
Gradle version
8.3
Build scan URL (optional)
No response
Your Environment (optional)
No response
Current Behavior
Let's imagine we have two tasks:
aband we have declared that
task("a") { finalizedBy("b") }.If we cancel the build (CTRL-C in the CLI, stop button in IDEA) while
ais running, bothaandbare marked as cancelled.Expected Behavior
ashould be cancelled, butbshould run anyway.Context (optional)
I would expect that long-running tasks that start servers would fall under the same use-case, and thus would also need to be finalized even if they are cancelled before finishing.
Steps to Reproduce
Gradle version
8.3
Build scan URL (optional)
No response
Your Environment (optional)
No response