Kevin Jackson wrote:
On 9/16/06, Jesse Glick <[EMAIL PROTECTED]> wrote:
[...]
(I'd steer away from groovy before anyone suggests it ;))
Kevin, anything in particular you don't like about Groovy?
In my experience it is an excellent scripting language and
has excellent Ant support but as coauthor of the upcoming
Groovy in Action book I guess I am a little biased. :-)
Ant integration with Groovy crops up many times throughout
the book. Here is just one example (using Groovy in a
traditional build file - as distinct from using a Groovy
file as the build file - which would just involve leaving
off the outer tags in this example):
<groovy>
def scanner = ant.fileScanner {
fileset(dir: properties['src.dir']) {
include(name: '**/*.xml')
}
}
def nameCheck = scanner.every{
file -> file.name.contains('build')
}
def totalSize = 0
def fileCount = 0
def maxSize = 0
for(file in scanner){
fileCount++
if (file.size() > maxSize) maxSize = file.size()
totalSize += file.size()
}
if (nameCheck || totalSize / fileCount > 50 ||
maxSize > 100 || fileCount > 10)
properties.shouldCompress = true
</groovy>
This just sets a property ready for a subsequent
'if' or 'unless' attribute based on some conditions
which would be rather hard to set up declaratively.
Cheers, Paul.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]