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