Levi Yourchuck wrote:
> 
> I must have some cognitive disturbance because I am at a loss.
> If my task C is 'clean' then I cannot dependsOn it in any task, correct?
> 

You can depend on clean conditionally, for example based on whether a
particular task is specified on the command line. You can also defer the
decision what dependsOn relationships to add with task.dependsOn {}.
Likewise, you can skip a task conditionally with task.onlyIf {}.


Levi Yourchuck wrote:
> 
> I mean if my task is create_distro, it seems logical for me to say
> dependsOn clean correct?
> 
It's not completely unreasonable but I'd probably prefer to leave it up to
whoever invokes Gradle whether to run clean or not.


Levi Yourchuck wrote:
> 
> Right now I do this pattern:
>       
> task create_distro << {
>  [ clean, untax, jac, compileJava, classes, processResources, jar,
> images_jar ].each {println "doing --> $it";it.execute();}
> }
> 
> Is this the recommended approach for ordering tasks?
> 

No, it is discouraged and might stop working at some point. It's better to
check whether create_distro will be executed and only then add the necessary
dependsOn relationships. Gradle doesn't offer a clean solution for this yet
because gradle.taskGraph.whenReady() is too late for adding dependsOn()
relationships, but checking gradle.startParameter is often good enough.

--
Peter Niederwieser
Principal Engineer, Gradleware 
http://gradleware.com
Creator, Spock Framework 
http://spockframework.org
Twitter: @pniederw

--
View this message in context: 
http://gradle.1045684.n5.nabble.com/dependency-ordering-tp4597282p4610788.html
Sent from the gradle-user mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email


Reply via email to