Closed dannybduval closed 4 years ago
you can use the finalizedBy
relationship between the tasks so the clear task will always be ran.
tasks.named("testDebugComposer").configure {
finalizedBy tasks.named("clearConnectedDevices")
}
IIRC you need to remove the dependsOn: testDebugComposer
because the bidirectional relation of depends and finalized by messes with things so they don't behave as expected.
but it will then allow you to run the clear task with or without the composer task
https://docs.gradle.org/current/dsl/org.gradle.api.Task.html#org.gradle.api.Task:finalizedBy https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:finalizer_tasks "Finalizer tasks will be executed even if the finalized task fails."
otherwise you might be able to subclass the composer task
Logged https://github.com/gojuno/composer/issues/176 against composer, but seeing if it is felt to go here.
As mentioned in the above issue, any failure in the chain of observers fails, it results in an exit one.
In our case we have custom tasks created to handle this. e.g.:
Where this task is a custom task that goes to each connected emulator and wipes them after a run finishes.
Even if we run with
--continue
, the process will error and not go to the task thatmustRunAfter testDebugComposer
.