Hi Rene,
   That explains it. But, I'd like to use the '<<' notation in case there's
already a "cleanAll" task defined. How would I go about keeping the "doLast"
syntax and making it work? Do I need to then explicitly create my own delete
task and execute it??

Eg.
task("cleanAll") << {
    def delete = new Delete()
    delete = delete.delete("some dir")
    delete.execute()
}

Doing this results in a nullpointer exception btw. "new Delete()" generates
the error.



On Sat, Aug 21, 2010 at 9:41 AM, Rene Groeschke <[email protected]> wrote:

>  Hi Eric,
> I think you run into the same pitfall every gradle newcomer run into.
> Gradle has a configuration phase and an execution phase.
> If you declare a task of the type Delete, you have to configure this task
> in the configuration phase like you do in your second code snippet.
>
>
> task("cleanAll", type:Delete) {
>    delete("some dir")
> }
>
> The syntax
>
> task << {
> }
>
> is a shortcut for the
>
> task.doLast{
> }
>
> If you define your delete task like you do in your first snippet
>
>
> task("cleanAll", type: Delete) << {
>    delete("some dir")
> }
>
> the cleanAll task is configured in the configuration phase without
> informations what to delete. In the execution phase, your cleanAll task does
> nothing but adding "someDir" to the delete task AFTER the task itself is
> already executed.
>
> regards,
> rené
>
>
>
> Am 21.08.10 02:29, schrieb Eric Berry:
>
>  I was defining a 'cleanAll' task and I ran into a little confusion with
>> the Task definition syntax described here:
>> http://www.gradle.org/0.9-rc-1/docs/userguide/more_about_tasks.html
>>
>> If I define my task like this:
>> [code]
>> task("cleanAll", type: Delete) << {
>>    delete("some dir")
>> }
>> [/code]
>>
>> It doesn't work. However defining it as below does:
>> [code]
>> task("cleanAll", type:Delete) {
>>    delete("some dir")
>> }
>> [/code]
>>
>> I thought these two formats were interchangeable and resulted in the same
>> thing? When should one be used vs. the other?
>>
>> I'm using Gradle 0.9-rc-1
>>
>> Thanks,
>> Eric
>>
>> --
>> Learn from the past. Live in the present. Plan for the future.
>> Blog: http://www.townsfolkdesigns.com/blogs/elberry
>> jEdit <http://www.jedit.org> - Programmer's Text Editor
>> Bazaar <http://bazaar.canonical.com> - Version Control for Humans
>>
>
>
> --
> ------------------------------------
> Rene Groeschke
>
> [email protected]
> http://www.breskeby.com
> http://twitter.com/breskeby
> ------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>


-- 
Learn from the past. Live in the present. Plan for the future.
Blog: http://www.townsfolkdesigns.com/blogs/elberry
jEdit <http://www.jedit.org> - Programmer's Text Editor
Bazaar <http://bazaar.canonical.com> - Version Control for Humans

Reply via email to