You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "Reynolds, Ron" <Ro...@msdw.com> on 2000/06/07 16:54:19 UTC

properties - order of evaluation?

hello again.  thanks very much for the info so far - what i'm hearing is
that the docs are a great place to start, but afterwards go to the source to
find out what's really supported...

i noticed that i get "null"s in various places when i use <property
file="mypropfile.prop"/> depending on the order in which the properties get
loaded from the file.  for instance:
	prop1=foo
	prop2=${prop1}-bar
produces foo and foo-bar, but

	prop2=foo
	prop1=${prop2}-bar
produces foo and null-bar.  

this looks like an order-of-evaluation problem. is there a fix or do i write
this off as a property of properties?

i've been thinking about this further (again, i haven't looked at the source
yet) and what seems to be happening is that symbols are being evaluated as
the properties are being loaded.  it seems to me that if the properties were
all loaded first, and then the symbols where evaluated in a second pass this
problem wouldn't exist, yes?

thanks for all the help. :)
........ron.

Re: properties - order of evaluation?

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "RR" == Reynolds, Ron <Ro...@msdw.com> writes:

 RR> this looks like an order-of-evaluation problem. is there a fix or
 RR> do i write this off as a property of properties?

Your best bet is to do so, at least for the moment, yes. Properties
are expected to change their behavior in the next Ant releases.

 RR> i've been thinking about this further (again, i haven't looked at
 RR> the source yet) and what seems to be happening is that symbols
 RR> are being evaluated as the properties are being loaded.

Yes, and property tasks get executed at parse time and only the last
value for properties in the build.xml file gets assigned if there are
several tasks for the same property name ...

Properties are confusing at the moment. Better consider them something
like XML entities which is totally consistent with replacing them at
parse time.

Stefan