Ah, that makes sense. Sounds like what we have implemented doesn't quite fit the intent.
Thanks for the explanation Luke. John — Sent from Mailbox for iPhone On Fri, Nov 1, 2013 at 6:48 AM, Luke Daley-2 [via Gradle] <ml-node+s1045684n571197...@n5.nabble.com> wrote: > On 31/10/2013, at 3:02 PM, johnrengelman <john.r.engel...@gmail.com> wrote: >> We've implemented a couple new features in our build using the 'finalizedBy' >> feature but I'm seeing some behavior that I'm not sure is correct. >> >> Assume we have this build >> >> tasks a, b, c, d >> >> a.finalizedBy d >> c.dependsOn [a, b] >> a.onlyIf { project.hasProperty('foo') } >> b.onlyIf { !project.hasProperty('foo') } >> >> when I execute this build without the 'foo' property, then I expect only b >> and c to execute and a and d to be skipped. >> >> However, what I see is that b, c, and d execute and a is skipped. >> >> So it appears that the 'finalizedBy' task (d) executes regardless event >> though the parent task (a) was skipped. >> >> Is this expected behavior or should the finalizing task also skip in this >> scenario? > It's expected. > Skipping a task doesn't affect the execution of any other task. It's the most > sensible default as it gives downstream tasks more flexibility as they can > inspect the upstream task and make their own decision on what to run. > Consider this: > task startDb {} > task stopDb {} > task updateDbSchema { > dependsOn startDb > finalizedBy stopDb > onlyIf { dbNeedsUpdate() } > } > Skipping updateDbSchema doesn't change the fact that I need to stop the db. > If skipping tasks propagated through the graph it would be very difficult to > reason about in a sufficiently large graph. > -- > Luke Daley > Principal Engineer, Gradleware > http://gradleware.com > Join us at the Gradle eXchange 2013, Oct 28th in London, UK: > http://skillsmatter.com/event/java-jee/gradle-exchange-2013 > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > http://xircles.codehaus.org/manage_email > _______________________________________________ > If you reply to this email, your message will be added to the discussion > below: > http://gradle.1045684.n5.nabble.com/Should-finalizing-tasks-be-executed-if-the-parent-task-is-skipped-tp5711969p5711974.html > To start a new topic under gradle-dev, email > ml-node+s1045684n1436218...@n5.nabble.com > To unsubscribe from gradle-dev, visit > http://gradle.1045684.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1436218&code=am9obi5yLmVuZ2VsbWFuQGdtYWlsLmNvbXwxNDM2MjE4fDIyMTUyNjEzNQ== -- View this message in context: http://gradle.1045684.n5.nabble.com/Should-finalizing-tasks-be-executed-if-the-parent-task-is-skipped-tp5711969p5711975.html Sent from the gradle-dev mailing list archive at Nabble.com.