ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shatzer, Larry" <>
Subject Macrodef and parallel in a recursive situation
Date Thu, 16 Oct 2003 20:32:28 GMT
I have run into a possible bug when working with macrodef and parallel in a
recursive situation.

The following build file snip example exhibits this: (This requires the <if>
ant-contrib task, and <math> from Antelope, soon to be ant-contrib).

  <macrodef name="recurse">
    <attribute name="until"/>
    <attribute name="current"/>
    <attribute name="method"/>
        <equals arg1="${until}" arg2="${current}"/>
          <echo message="Method: ${method} done"/>
            datatype  = "int"
            operand1  = "${current}"
            operand2  = "1"
            operation = "+"
            result    = "newcurrent"
            message = "1: M: ${method}, C: ${current}, U: ${until}"
          <sleep seconds="1"/>
            message = "2: M: ${method}, C: ${current}, U: ${until}"
            current = "${newcurrent}"
            method  = "${method}"
            until   = "${until}"
  <target name="test">
      <recurse current="0" method="0" until="5"/>
      <recurse current="0" method="1" until="10"/>
      <recurse current="0" method="2" until="15"/>
      <recurse current="0" method="3" until="20"/>

Depending on the situation, this could result in an endless loop.

I use something similar to this method when checking out/updating a list of
cvs projects in parallel, and ran across the methoddef's steeping on each
others toes. I was converting from using antcall to macrodef.

I don't know how to handle this, since macrodef should be able to set and
read properties in a global context, but sometimes you want local variables.
Maybe add a flag to <attribute> of global/local?

-- Larry

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

View raw message