So if I interpret you correctly and look at the GroovyDoc for the TaskOutputs...

 TaskOutputs    file(Object path)

this is a replace because it would be an assignment

and

 TaskOutputs    files(Object... paths)

this is additive because it's multiple?

So another general rule would be plural methods are additive, singular replace?

On Wed, Sep 28, 2011 at 11:08 AM, Luke Daley <[email protected]> wrote:
>
> On 28/09/2011, at 5:08 PM, phil swenson wrote:
>
>> one thing I struggle with is determining whether methods are additive
>> or have replace behavior.
>>
>> For example for the TaskOutputs interface I see this:
>>
>> /**
>>     * Registers some output files for this task.
>>     *
>>     * @param paths The output files. The given paths are evaluated as
>> for {@link org.gradle.api.Project#files(Object...)}.
>>     * @return this
>>     */
>>    TaskOutputs files(Object... paths);
>>
>>
>> I eventually found that it's additive by looking through the gradle
>> source.  But there is no way to know this from the doc.  Is there a
>> reasonable way to figure this out?
>>
>> yesterday I was told that when you declare source sets like this:
>>
>> sourceSets.main.resources {
>>    srcDirs = ["../../src/java/core/bpo/ui/portlet"]
>>    include "*.properties"
>> }
>>
>> srcDirs is additive, but srcDir replaces.
>>
>> How would I know that?
>
> assignment *always* replaces. If the thing is a collection, the method is 
> always additive.
>
> --
> Luke Daley
> Principal Engineer, Gradleware
> http://gradleware.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to