--- Steve Loughran <[EMAIL PROTECTED]> wrote:
[SNIP]
> I've taken to declaring macros/presets in their own
> ns too.
I envision a world where this is not considered
remarkable. Macros, presets, and scripts are good for
rapid prototyping, but if a task can be composed of
other tasks in Java, what is less correct about the
composite task being written in "Ant"? I consider the
following a good example of something cool to do with
ns'd presets: at my last job we had loads of legacy
stuff using Btrieve databases. In trademark gross
abuse of Ant I used it for all kinds of utility jobs
in our final conversion away from all that.
Historically Btrieve has been used a lot through a
command-line utility called BUTIL. So I created a
BUTIL antlib along the lines of:
<presetdef name="create">
<apply executable="BUTIL"
failifexecutionfails="true">
<arg value="-CREATE" />
<targetfile />
<srcfile />
</apply>
</presetdef>
<presetdef name="copy">
<apply executable="BUTIL"
failifexecutionfails="true">
<arg value="-COPY" />
<srcfile />
<targetfile />
</apply>
</presetdef>
and so on for whichever options I needed...
so what would have been (in a batch file):
BUTIL -CREATE merged.btr merged.des
FOR %%X in (foo.btr bar.btr) do (
BUTIL -COPY %%X merged.btr
)
comfortably became (declaring the "butil" ns in the
calling buildfile):
<butil:create>
<fileset file="merged.des" />
<mapper type="glob" from="*.des" to="*.btr" />
</butil:create>
<butil:copy>
<fileset dir="${basedir}" includes="*.btr" />
<mapper type="merge" to="merged.btr" />
</butil:copy>
i.e. those familiar with the command-line tool would
have no problem understanding what was going on...
anyway...
-Matt
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]