I'm about to start working on finalising tasks. Following are my initial
thoughts about how I currently see the implementation:
- the relationship between tasks is specified on the finalised task,
like Adam suggested:
tasks.withType(Reporting) {
finalisedBy(buildDashboardTask)
}
plus all the other flavours of it just like for dependsOn and mustRunAfter
- the relationship has to be stored on both the finalised task (to be
able to add the finialising task to the graph when the finalised task is
being added) and on the finalising task (to be able to use that info
when verifying that at least one of the tasks it finalises has been
executed and the finalising task is not otherwise required to be executed).
- a new TaskExecutionState or a flag on TaskInfo has to be added to
differentiate between a state where a task is a finaliser and is
otherwise not required to be executed, so that it can be skipped when
the finalised task(s) did not run for whatever reason as described in
the design spec:
https://github.com/gradle/gradle/blob/master/design-docs/reporting.md#implementation-approach-2
- a new TaskExecuter that would skip execution of a finalising task if
none of the finalised tasks run and the finalising task is otherwise not
required to be executed - that information can only be obtained from
TaskInfo so it would now need to be passed to TaskExecuter.execute()
- I have no idea on how to achieve skipping dependencies of a finalising
task when the finalising task should be skipped - it gets really tricky
as those dependencies might be made mandatory by making the finalising
task mandatory after being added to the graph...
- Modify DefaultTaskExecutionPlan to go into "finaliser task mode only"
after a task failure not handled by failureHandler; if in that mode then
getNextReadyAndMatching() would use a Spec that only allows finaliser
tasks, and (I don't know how to achieve that) finaliser task dependencies
After looking at the code it seems that the biggest problem for me might
be handling dependencies of finalising tasks when it comes to skipping
them when the finalising task is skipped and how to make sure that those
dependencies run after a task failure. Any suggestions?
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email