Russel Winder wrote:
On Thu, 2010-04-08 at 06:34 +1000, Adam Murdoch wrote:
[ . . . ]
For example, this kind of task definition is declarative

task copy(type: Copy) {
     from 'src/java'
     into 'build'
}

and is much preferable to this imperative task definition:

task copy << {
     ant.copy(dir: 'src/java', todir: 'build')
}

Actually I think both of these are declarative, it is simply that the
former represents an inheritance of a prototype task with amendment of
fields whereas the latter represents delegation with amendment of
fields.

Far more important that a spurious declarative/imperative tag is that
the former represents use of a Gradle built-in where the latter is
delegation to an Ant task.

It's possibly splitting hairs and I'm partially doing this to confirm my own understanding, but...

The first case is declarative in that you are declaring a task and how it hooks up. Gradle has full understanding of all relationships involved.

The second case (using <<) is executing opaque groovy code at execution time that just happens to be delegating to ant. It's only declarative in that a block of script code is being declared... which, to me at least pedantically, is imperative.

If there were some way to still do the ANT delegation without the << then it would be declarative.

...then again, it is late.
-Paul


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

   http://xircles.codehaus.org/manage_email


Reply via email to