ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stephan beal <step...@wanderinghorse.net>
Subject property expansion: expected behaviour?
Date Wed, 24 Apr 2002 14:12:39 GMT
Ant 1.4.1, i'm calling ProjectHelper.replaceProperties(...) on a string like 
the following:

$foo = ${build.top.dir};
print "$foo\n";

The property expansion works fine, but it also strips the $ from '$foo', so i 
end up with:

foo = "/some/path;
print "foo\n";

i'm attaching a small class which tests the xml code below, showing the 
behaviour:

<taskdef name="propexpand" 
classname="net.sf.antcontrib.logic.PropExpansionTest"/>

<property name="whattodrink" value="milk"/>
<propexpand replaceproperties="true">
	$foo = "${whattodrink}";
	print "foo=$foo\n";
</propexpand>

<propexpand replaceproperties="false">
	$foo = "${whattodrink}";
	print "foo=$foo\n";        
</propexpand>

It produces this output:
property expansion = [true]
text=
        foo = "milk";
        print "foo=foo\n";

property expansion = [false]
text=
        $foo = "${whattodrink}";
        print "foo=$foo\n";


Note all the missing dollar signs in the first one.

----- stephan
stephan@einsurance.de - http://www.einsurance.de
Office: +49 (89)  552 92 862 Handy:  +49 (179) 211 97 67
"I didn't give in to the Nazis and I won't give in to the bladder." 
- The Queen Mum

Mime
View raw message