ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <>
Subject Re: Getting 1.6 out the door
Date Tue, 02 Sep 2003 16:49:13 GMT
On Tuesday 02 September 2003 16:26, Gus Heck wrote:
> >> <macrodef> follows (I think) the same rules of properties as
> >> <antcall> with
> >> inheritall=yes.
> Modeling after antcall...? I am wary of this as antcall is broken at the
> top level.
> I certainly
> havn't looked at macrodef closely enough to know if it will be subject
> to the same problem, but it makes me wonder. It might even be the case
> that antcall should be deprecated and replaced with macrodef if macrodef
> works at the top level and can truely duplicate antcall's functionality.

I meant that on reading DD's e-mail, I realized that the property
expansion was the same as for using antcall.

The <macrodef> code is totally different to <antcall>, and <macrodef> is
meant to duplicate antcall's functionality - except for the case where
antcall is used as a template. (My build files had a number of such

However <macrodef> does allow recursive calling so doing:

<macrodef name="bad.recursive">

will cause an stack overflow if called.

One can do:

<project default="recursive" xmlns:ac="antlib:net.sf.antcontrib">

  <macrodef name="recursive">
    <attribute name="t"/>
      <echo>Testing [${t}]</echo>
        <equals arg1="${t}" arg2=""/>
          <ac:propertyregex property="x" input="${t}"
                            regexp="(.*).$" replace="\1"/>
          <recursive t="${x}"/>

  <target name="recursive">
    <recursive t="hello world"/>


Giving the result:
     [echo] Testing [hello world]
     [echo] Testing [hello worl]
     [echo] Testing [hello wor]
     [echo] Testing [hello wo]
     [echo] Testing [hello w]
     [echo] Testing [hello ]
     [echo] Testing [hello]
     [echo] Testing [hell]
     [echo] Testing [hel]
     [echo] Testing [he]
     [echo] Testing [h]
     [echo] Testing []
     [echo] DONE!


Note: I am not saying that one should do the above.., it is just
      the first example that came into my head.

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

View raw message