Hi,
Am Mi, 11.05.2011, 21:38, schrieb Adam Murdoch:
>
> On 12/05/2011, at 1:53 AM, Rene Groeschke wrote:
>
>
>> Hi,
>> I got it basically working with your hint. I've already noticed that
>> this is not (yet) public api. FYI: Unfortunately, If I mark
>> "ExampleModel" as an input property in my task i got an error:
>> ---------------
>> java.io.NotSerializableException:
>> org.gradle.api.internal.AsmBackedClassGenerator$MixInDynamicObject
>> ---------------
>> to bad. That's the price on skating on thin ice, I think.
>
> Could you add a jira issue for this? A decorated object should be
> serializable if the undecorated object is.
>
> When you use @Input on a property, the property value is serialized when
> the task is executed. Next time the task is executed, the value is
> deserialized and then compared against the new value using equals(). So,
> this means that your ExampleModel class will need to be serializable, and
> implement a useful equals() method.
That's what my current implementation looks like, but as mentioned that
does not play well with being convention aware. I'll create an issue about
that problem tomorrow.
>
> An alternative, depending on what you're doing, is to use @Nested on your
> model property, rather than using @Input. This will allow you to use the
> Gradle annotation on the properties of the model object:
>
>
> class ExampleTask { @Nested ExampleModel model
> }
>
>
> class ExampleModel { @Input String title
> @InputDirectory @SkipWhenEmpty File someDir
> }
>
>
> There are a few benefit with this: you can apply different constraints to
> different properties, Gradle will take care of the serialization and
> comparison, and you get a better info message telling you what's changed.
I think that's exactly what I need in my case. will replace the
serializable stuff by thta @Nested Annotation.
thanks again,
regards,
rene
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email