ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <>
Subject Re: suggestion : Ant 1.8 full dist to include a 'scripting lang'
Date Fri, 22 Sep 2006 00:41:05 GMT
Kevin Jackson wrote:
> On 9/16/06, Jesse Glick <> wrote:
>> [...]
> (I'd steer away from groovy before anyone suggests it ;))

Kevin, anything in particular you don't like about Groovy?

In my experience Groovy 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 several 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):

def scanner = ant.fileScanner {
   fileset(dir: properties['src.dir']) {
        include(name: '**/*.xml')
def nameCheck = scanner.every{
   file ->'build')
def totalSize = 0
def fileCount = 0
def maxSize   = 0
for(file in scanner){
   if (file.size() > maxSize) maxSize = file.size()
   totalSize += file.size()
if (nameCheck || totalSize / fileCount > 50 ||
       maxSize > 100 || fileCount > 10)
   properties.shouldCompress = true

This just sets a property ready for a subsequent
'if' or 'unless' attribute based on some conditions
which would be somewhat cumbersome to do declaratively.

I have also been playing around with AntUnit and I certainly
find Groovy to be a natural fit when you outgrow AntUnit.

Cheers, Paul.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message