Hi Peter, thanks very much, that explains it.

Will probably stick with the '<<' notation, and switch the others over as
well for consistency sake.

Adding the 'task' argument for just that one task would likely confuse other
developers.

Is the delegation of the task closure to the Task itself, and the delegation
of the inner closure to the project a gradle issue, or something to do more
with scoping and Groovy? Should I create a bug/ticket for this?

Cheers.
Eric

On Tue, Jun 7, 2011 at 10:09 PM, Peter Niederwieser <[email protected]>wrote:

>
> Eric Berry wrote:
> >
> > Is the '<<' the correct way to do this, so I should change all the Delete
> > tasks over to use it?
> >
>
> The correct way is to use one of
>
> task foo << {
>  delete "bar" // Project.delete
> }
>
> and
>
> task foo(type: Delete) {
>  delete "bar" // Delete.delete
> }
>
> A possible explanation why the latter doesn't work for you is that the
> delete() call inside the eachFile() closure is mistakenly resolved to
> Project.delete(). In this case you should be able to work around the
> problem
> by making the task closure accept a "task" argument and using
> "task.delete()" inside eachFile().
>
> --
> Peter Niederwieser
> Principal Engineer, Gradleware
> http://gradleware.com
> Creator, Spock Framework
> http://spockframework.org
> Blog: http://pniederw.wordpress.com
> Twitter: @pniederw
>
>
> --
> View this message in context:
> http://gradle.1045684.n5.nabble.com/RFC-Weird-configuration-vs-execution-phase-issue-tp4463377p4466363.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
>
>
>


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

Reply via email to