You have to exclude b, not disable (skip) it:
if (!project.hasProperty("runB")) {
gradle.startParameter.excludedTaskNames += "b"
}
This is the equivalent of "-x b" on the command line.
--
Peter Niederwieser
Principal Engineer, Gradleware
http://gradleware.com
Creator, Spock Framework
http://spockframework.org
Twitter: @pniederw
ecrane wrote:
>
> I have something like the following:
>
> task a << {println "a"}
>
> task b(dependsOn:a) << {println "b"}
>
> task c(dependsOn:a) << {println "c"}
>
> b.enabled = project.hasProperty('runB')
>
> My goal here is to skip task b AND any tasks it depends upon unless the
> project property 'runB' has been set. Unfortunately, even though b is
> skipped, task a runs anyways. I don't want to explicitly disable task a as
> well, because it is used by task c which doesn't care about the 'runB'
> property.
>
> Is there some way I can do what I'm after? If task b is disabled, I don't
> want to run it OR its dependsOn tasks. At the same time, if I run task c,
> I want to run both a and c as normal.
>
--
View this message in context:
http://gradle.1045684.n5.nabble.com/Any-way-skip-a-task-AND-all-tasks-it-depends-on-tp4992043p4993124.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