ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: Asking for new feature: Self-Discovery of service to make Ant a real extensible system
Date Mon, 01 May 2006 22:12:32 GMT
--- Steve Loughran <stevel@apache.org> 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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message