You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "Jack J. Woehr" <ja...@purematrix.com> on 2004/06/02 20:37:59 UTC

Possible Ant 1.7 alpha bug: property expansion.

I was just adding  to the Ant Wiki AntOddities page the following macrodef :

     <!-- Allows you define a new property with a value of ${${a}.${b}} which can't be done by the Property task alone.  -->
         <macrodef name="macro.compose-property">
             <attribute name="name"/>
             <attribute name="stem"/>
             <attribute name="selector"/>
             <sequential>
                 <property name="@{name}" value="${@{stem}.@{selector}}"/>
             </sequential>
         </macrodef>

I wrote a quick counter-example which shows how expansions of properties in Ant is not recursive:

     <?xml version="1.0" encoding="UTF-8"?>
     <project basedir="." default="all" name="changeme">
         <target name="all">
             <property name="a" value="arf"/>
             <property name="b" value="bark"/>
             <property name="arf.bark" value="woof woof woof"/>
             <echo message="${${a}.${b}}"/>
         </target>
     </project>

but when I ran it, in Ant version 1.7 alpha built from CVS last night,  instead of getting the  unexpanded value of
the overall expression which I expected:

     [echo] ${${a}.${b}}

I received the unexpected:

     [echo] ${${a}.bark}

This does not seem to me to be correct by the rules of Ant. Either the internal expansion should be complete or not
at all ... the right term should not expand and leave the left unexpanded. It seems to me the expected answer was
the one returned by Ant version 1.6.1 but I don't have that built now to see if the current behavior is a regression.

--
Jack J. Woehr      # We have gone from the horse and buggy
Senior Consultant  # to the moon rocket in one lifetime, but
Purematrix, Inc.   # there has not been a corresponding moral
www.purematrix.com # growth in mankind. - Dwight D. Eisenhower




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org