A couple of points:
- You don't need to extend ConventionTask to get a "conventionMapping"
property (and mechanism). DefaultTask is good enough.
- Solving the evaluation order problem isn't easy. At the moment it requires
convention mapping and explicit use of getters. Maybe we'll come up with
something better in the future.
- The new extension mechanism is not related to the evaluation order
problem. It's "just" a nicer way to implement a configuration block like:
reporting {
...
}
This can now be done by registering an object as a "reporting" extension.
The closure will then configure the object.
--
Peter Niederwieser
Principal Engineer, Gradleware
http://gradleware.com
Creator, Spock Framework
http://spockframework.org
Twitter: @pniederw
Benjamin Muschko wrote:
>
> Hi,
>
> as a plugin developer what is the recommended way of reading convention
> properties and setting the values to fields of classes that implement
> DefaultTask? In the past all my Task classes used to extend the internal
> class org.gradle.api.internal.ConventionTask and had to access fields
> using getter method. Extending ConventionTask has multiple drawbacks: a)
> You can only access the values via getter methods which fields very
> clunky, b) ConventionTask is an internal class which might be deprecated.
>
> In the future I'd like to stay away from using ConventionTask and have my
> tasks implement DefaultTask. However, I am having trouble setting the
> fields with values that I read from my Convention. It pretty much boils
> down to the problems reported in this
> http://gradle.1045684.n5.nabble.com/Use-plugin-convention-property-in-apply-method-td4731829.html
> posting . I think plugin developers often times simply want to read
> convention properties when creating a task and set them as field values.
> Having to use convention mapping simply feels like more work than there
> should be.
>
> From your point of view is there a way to get this working? I read there
> will be an
> http://wiki.gradle.org/display/GRADLE/Gradle+1.0-milestone-5+Release+Notes#Gradle1.0-milestone-5ReleaseNotes-NewDSLextensionmechanismforplugins
> extension mechanism for plugins with 1.0-milestone-5 . Is there any kind
> of documentation on how this is going to work and how to use it?
>
> Thanks,
>
> Ben
>
--
View this message in context:
http://gradle.1045684.n5.nabble.com/Convention-mapping-for-plugins-tp4885140p4886342.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