Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Quirky behaviour in how macrodef attribute values are resolved?

Quirky behaviour in how macrodef attribute values are resolved?

2007-08-09       - By peter reilly
Reply:     1     2  

This is due to
http://issues.apache.org/bugzilla/show_bug.cgi?id=42046
(properties get double-expanded in macrodefs)

Peter

On 8/9/07, Davy Toch <Davy.Toch@(protected)> wrote:
> I have the following script:
>
> <project default="test">
>   <property name="prop2" value="value2-${prop1}"/>
>   <property name="prop1" value="value1"/>
>   <target name="test">
>     <echo>prop2 as property  (from target)   : ${prop2}</echo>
>     <test/>
>   </target>
>
>   <macrodef name="test">
>     <attribute name="prop2" default="${prop2}"/>
>     <sequential>
>       <echo>prop2 as property  (from macrodef) : ${prop2}</echo>
>       <echo>prop2 as attribute (from macrodef) : @{prop2}</echo>
>     </sequential>
>   </macrodef>
> </project>
>
> The output is:
>
> D:\tmp>ant
> Buildfile: build.xml
>
> test:
>      [echo] prop2 as property  (from target)   : value2-${prop1}
>      [echo] prop2 as property  (from macrodef) : value2-${prop1}
>      [echo] prop2 as attribute (from macrodef) : value2-value1
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
>
> The output of the first 2 <echo>'s are what I expected, but the
> third <echo> output seems odd.
>
> Is this normal ANT behaviour, or should this be considered a bug
> for which I should open a bug report?
>
> Btw, I got this behaviour on ANT 1.6.5 and 1.7.0.
>
> Best regards,
> Davy Toch
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.