On Jun 24, 2009, at 10:42 PM, Steve Appling wrote:
Hans Dockter wrote:
<snip>
4) I would like to be able to specify that a chain of dependent
tasks only execute a task if Task.didWork is true for all of its
dependents.
I don't fully understand this. Could you explain this a bit more?
<snip>
- Hans
Sure - I did not express that very well at all. I also wrote it
before I attempted an implementation, so I think I have a better
idea of what might be needed now.
In the syntax that I implemented, you could say:
test.onlyIf { isNeeded() }
I wanted this to be able to look at the TaskDependencies for the
test task and only execute if Task.didWork was true for one of them.
I was not able to figure out how to use TaskDependencies to
accomplish this. task.getTaskDependencies(task) only returns the
tasks that are explicitly added using dependsOn and doesn't seem to
take into account the tasks needed to build the artifacts in the
configurations that are contained in the TaskDependencies object.
At the moment our task execution graph does not provide this
information nor does it have a data model for this. What should be
straight forward to do is to add a method to the execution graph that
computes this on the fly for a certain task.
In this case (a Test task), I would like the isNeeded method to
return true if either compile or compileTests didWork() is true or
if any of the tasks needed to build artifacts in the testRuntime
configuration didWork() was true. Currently it does not check the
tasks that might be derived from the configuration.
It is similar to the idea of smart exclusion except that this needs to
be done at execution time.
I was hoping that a general purpose isNeeded helper could do this
for all tasks in the same way, but it is possible that certain
subclasses of Task just need their own specific implementations.
Right.
- Hans
--
Hans Dockter
Gradle Project Manager
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email