Author Login
Post Reply
Hi,
I wanted to be able to easily write recursive Ant build files, so I
developed a macro and a small patch to Ant. I'd like the advice of the
dev list as to if and how I should submit this patch for inclusion in
Ant.
The patch (roughly 30 extra lines of code across 6 files) adds two new
*dynamic* properties to Ant:
1) ant.project.target - the default target of the current project
2) ant.current.target - a comma-separated list of the actual targets
that were invoked on the current project
These properties are updated automatically, similar to ant.file or
ant.project.name.
The "recurse" macro uses the antcontrib:for task to iterate over
multiple targets (the antcontrib jar required the "for" task to be
added to its properties). The macro can accept an explicit list of
targets, but I also wanted to be able to recurse on the targets that
were actually invoked.
Here's how you would use it:
<!-- define the "recurse" macro -->
<typedef file="recurse.xml"/>
<!-- "subdirs" is the ordered list of sub-folders that "recurse" uses -->
<filelist dir="." id="subdirs" files="x1,x2"/>
<!-- invokes the macro on the current target(s), which may be the
ones specified or the default target -->
<recurse/>
Alternatively:
<!-- invoke the macro on the specified targets -->
<recurse targets="this,that,other"/>
My Ant experience is limited, so I may have overlooked an existing way
to achieve this, but reading and searching suggests that others are
still missing recursion in Ant. I look forward to your advice!
All the best,
Colm.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@(protected)
For additional commands, e-mail: dev-help@(protected)