On 28/06/2011, at 6:33 AM, jbaruch wrote: > Yap, that will work until the Jira request will be resolved. Thanks for > sharing! > > P.S. GradleInc guys, would you mind if I'll try to resolve it myself? The > callback sounds pretty trivial to implement.
It's not quite as easy as it would seem. The problem is that Gradle, at the moment, allows you to configure a domain object at any point in the build, ie from build scripts, plugins, tasks, and event handlers. Even if you ignore that, Gradle also allows any project to configure the domain objects of any other project. So there's no point in time where you know that a domain object is fully configured. You could approximate it for now, by firing the event after the project's build script has executed. This is something we want to change. Each domain object will have a defined lifecycle. A domain object will be mutable to start with, then at some point in the build, we will 'lock' the object to make it immutable so that no further changes can be made to it. At this point, we can fire the 'whenConfigured' code for the domain object. We want to do this for every type of domain object. Exactly when the point when the object becomes immutable is an open question. Perhaps we'd start with the project objects, then configurations, publications, and so on, with tasks made immutable last. -- Adam Murdoch Gradle Co-founder http://www.gradle.org VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting http://www.gradleware.com
