You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Richard Landon <RL...@youbet.com> on 2000/08/07 22:58:34 UTC

RE: How to use $ in a ANT property value (Who knows what ANT SHOU LD do)

Try this, (insert into build.xml)

<property name="helperone.classes" value="Helper$$1.class:Helper$$2.class"/>
<property name="helpertwo.classes"
value="Helper$$$$1.class:Helper$$$$2.class"/>

<target name="tryme">
<echo message="BEGIN: Who knows what ANT will do?"/> 
<echo message="(1) ${helperone.classes}"/> 
<echo message="(2) ${helpertwo.classes}"/> 
<echo message="(3) Helper$$1.class"/>      
<echo message="(4) Helper$$1.class:Helper$$2.class"/> 
<echo message="(5) Helper$$$1.class:Helper$$$2.class"/>
<echo message="(6) Helper$$$$1.class:Helper$$$$2.class"/>
<echo message="END  : Who knows what ANT will do?"/>
</target>

RESULT: build tryme

BEGIN: Who knows what ANT will do?
(1) Helper1.class:Helper2.class                 
(2) Helper$1.class:Helper$2.class
(3) Helper$1.class
(4) Helper$1.class:Helper$2.class
(5) Helper$1.class:Helper$2.class
(6) Helper$$1.class:Helper$$2.class
END  : Who knows what ANT will do?
Completed in 0 seconds

(1) $$ gets expanded to <null> as in Helper$$1.class=>Helper1.class (NOT
CORRECT)
(2) $$ gets expanded to <null> leaving (for example) Helper$$1.class which
is then
expanded to $1 (CORRECT RESULT: BUT IS NOT CONSISTENT WITH ANT
DOCUMENTATION! In other
words the expansion of $$ is positionally and semantically dependent in ANT
1.1; it's apparently different in property values, that in macro expansions)
(3) Okay $$1 goes to $1 (BUT WHAT ABOUT 1? WHAT THE SEMANTIC DIFFERENCE:
One's in a property value; one isn't)
(4) $$1 also goes to $1 (and etc)
(5) $$$1 goes to $1 (BUT WHAT ABOUT 4 and 1 $$=>$$$ Huh? what's that?)
(6) $$$$1 goes to $$1 (and expansion of $$ or $ or something like that,
stops)
   (HEY BUT WHAT ABOUT 2? $$$$1 in (2) => $1 but in (6) goes to $$1?

IF YOU CAN MAKE SENSE OF ANY OF THIS, YOU'RE ALOT SMARTER THAN I AM!

Bottom line
============================================================================
============
ANT IS "WIERD" WITH REGARDS TO HANDLING $$: It dependents on how you use $$
which
is very confusing to figure out (at least to a dunce like me). Solution: try
various 
random numbers of $$.... and maybe you'll get lucky (maybe not!). I did, uh,
I think!

RE: How to use $ in a ANT property value (Who knows what ANT SHOULD do)

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
> -----Original Message-----
> From: Richard Landon [mailto:RLandon@youbet.com]
> Sent: Tuesday, 8 August 2000 6:59
> To: ant-user@jakarta.apache.org
> Subject: RE: How to use $ in a ANT property value (Who knows what ANT
> SHOULD do)
>
>
> Try this, (insert into build.xml)
>
> <property name="helperone.classes"
> value="Helper$$1.class:Helper$$2.class"/>
> <property name="helpertwo.classes"
> value="Helper$$$$1.class:Helper$$$$2.class"/>
>
> <target name="tryme">
> <echo message="BEGIN: Who knows what ANT will do?"/>
> <echo message="(1) ${helperone.classes}"/>
> <echo message="(2) ${helpertwo.classes}"/>
> <echo message="(3) Helper$$1.class"/>
> <echo message="(4) Helper$$1.class:Helper$$2.class"/>
> <echo message="(5) Helper$$$1.class:Helper$$$2.class"/>
> <echo message="(6) Helper$$$$1.class:Helper$$$$2.class"/>
> <echo message="END  : Who knows what ANT will do?"/>
> </target>
>
> RESULT: build tryme
>
> BEGIN: Who knows what ANT will do?
> (1) Helper1.class:Helper2.class
> (2) Helper$1.class:Helper$2.class
> (3) Helper$1.class
> (4) Helper$1.class:Helper$2.class
> (5) Helper$1.class:Helper$2.class
> (6) Helper$$1.class:Helper$$2.class
> END  : Who knows what ANT will do?
> Completed in 0 seconds
>

For me,

BEGIN: Who knows what ANT will do?
(1) Helper$1.class:Helper$2.class
(2) Helper$$1.class:Helper$$2.class
(3) Helper$1.class
(4) Helper$1.class:Helper$2.class
(5) Helper$1.class:Helper$2.class
(6) Helper$$1.class:Helper$$2.class
END  : Who knows what ANT will do?

This is what I expected.

Can you type ant -version and let us know what it says. There was a bug, pre
1.1, that I fixed which would exhibit the behaviour you see.

Conor