Hans Dockter wrote:
Adam and I were talking yesterday about how to improve the skipping. We have discussed the idea that it would be nice to skip complete subsections of the DAG. One idea was to somehow find implicit rules on which to decide what makes up such a subsection.

For example:

clean<-resources<-compile<-testResources<-test

install dependsOn compile, test

In such a situation we could figure out, that testResources is only needed by the test task, and in the case the test task is skipped we could skip testResources as well. But to just define 'install dependsOn test', with the knowledge that compile is also executed when test is executed, would define any subsections to skip. But in this case I see dependsOn compile, test and dependsOn test as equivalent.

I don't think they are equivalent. To do its work, the install task depends on the output of compile, not test. It will work equally well regardless of whether test is executed or not, so install does not really depend on test at all. So, to correctly reflect the dependencies of the install task, compile should appear in the dependsOn, and test should not.

I think the problem here is that there is no way to declare that install should usually install a tested distribution, but that the testing is optional and can be safely skipped.

Some options for skipping:

1. Skipping a task simply removes all dependencies on that task when building the DAG. So, in the example above, you'd need to declare 'install dependsOn compile, test' for the install task to work when the test task is skipped.

2. Allow dependencies to be declared on artifacts (ie things) rather than tasks (ie the build steps that produce the things).

Almost every task uses artifacts as its input, so declaring dependencies on artifacts rather than the task(s) that happened to produce them is a more accurate description of the world, and it allows us to better deal with things like skipping.

For example, I think this better reflects our sample above:

test.dependsOn compile

artifacts.binaryDist.producedBy compile
artifacts.binaryDist.dependsOn test

install.dependsOn artifacts.binaryDist

Then, skipping a task removes that task from all dependsOn definitions, but not producedBy definitions.

3. Allow optional dependencies to be declared:

install.dependsOn compile
install.optionallyDependsOn test

Then, skipping a task removed that task from all optionallyDependsOn definitions, but not dependsOn definitions.

I think this should not lead to different behavior.

An alternative would be to introduce the concept of task groups. Each task can belong to 0..n task groups and we allow to skip specific tasks or task groups.

- Hans

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





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

   http://xircles.codehaus.org/manage_email



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

   http://xircles.codehaus.org/manage_email


Reply via email to