On 01/16/2013 07:05 AM, Adam Murdoch wrote:
I wonder if we should change the plan a little. We've just added a `TestReport` task type that can generate the HTML report. The goal is that at some point we remove the reporting from the `Test` task type and use this task instead. To make this work well, we need to make some improvements to the task graph. These are the same improvements that are already in the spec.

So, if you're interested, you could do something like this:

1. Make the task graph changes. There are two parts to this: schedule the dashboard task to run after the reports have been generated, without adding a hard dependency, and to automatically add the dashboard task to the graph whenever any reporting task is added to the task graph. 2. Change the `TestReport` task to implement `Reporting` so that it is included in the dashboard. 3. When the dashboard plugin is applied, add in a `TestReport` task and disable the test report in the `Test` task. 4. At some point later, once the above is stable, move #3 to the Java plugin and deprecate the test report in the `Test` task.

I had a first look at how we could implement that 'always runs after' dependency between tasks.

From what I can tell the reordering logic should go into DefaultTestExecutionPlan.addToTaskGraph(). My first idea is to check every time a task is added if it has to run before a task that already is in the executionPlan map. That means that even though the API should probably look like

project.tasks.withType(Reporting).all {
buildDashboard.runsAfter(it) // or maybe alwaysRunsAfter()? method name should show in a more explicit way that only a 'soft' dependency is defined here...
}

we would need to store the information about the soft dependency on both tasks - the task that should run before, as we need to act if a task that should run before is added to executionPlan after the task it should run after has already been added to it, as well as on the task that should run after(will explain that in a while). When that happens we should probably take the task that should run before and that is currently added, and together with all the tasks it depends on (also transitively) put it before (move it in front of) the task that should run after and is already in the executionPlan. If the task added depends on the task (also transitively) which should be executed after it then we shall throw and exception (CircularReferenceException?). When moving the task and the tasks it depends on we should also make sure that we're not moving any task that runsAfter() in front of a task that it should run after - that's why I believe that soft dependencies should be stored also on the task that runs after. If that happens we should probably throw an exception (CircularReferenceException?).

We could also think about moving the task that should run after but if we want to still run it before all tasks that depend on it we would need to be able to tell which tasks are the one that depend on it to move them together - currently we only know if task depends on another task but not if a task has tasks that depend on it.

It all sounds complicated and I don't know if I explained it clear enough. I also might be overcomplicating it and there might be a much simpler solution that I'm missing. Any suggestions? Or should I just implement my idea so that you can understand what I have on mind from the code?

Thanks,
Marcin

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to