ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <co...@cortexebusiness.com.au>
Subject RE: Two issues
Date Wed, 21 Feb 2001 22:43:25 GMT
Richard,

> -----Original Message-----
> From: Richard S. Hall [mailto:heavy@richardhall.net]
>
> There seems to be some confusion here.  I said that I can accept
> and deal with
> how Ant properties work

I didn't mean to imply otherwise. There is a lot of history to this issue
and I just wanted you to know and understand the way it works and why it has
come to be that way.

> -- I am not asking anyone to change them.
>  I only said
> that properties didn't work the way that I expected and that the
> documentation
> did not make it clear that a "dependent target" is considered a
> "parent" of the
> "depending target" as result of this dependent target properties override
> depending target properties.

This is sort of correct. The dependent target and the depending target are
at the same level of the hierarchy I outlined. All that really matters is
which <property> tag is fired first.

So, in the original example, if I set the property outside the targets, it
will be the first to set the value.

<property name="prop" value="X"/>

<target name="A">
        <property name="prop" value="A"/>
        <echo message="${prop}"/>
</target>

<target name="B" depends="A">
        <property name="prop" value="B"/>
        <echo message="${prop}"/>
</target>

This would print
X
X

If I add another one in at the top
<property name="prop" value="Y"/>
<property name="prop" value="X"/>

we would get
Y
Y

> This last fact is not captured in your
> hierarchical picture above and was not intuitive to me, but
> apparently it is
> for everyone else and that's okay.  That is why I said that I can
> deal with it.

If you use -verbose (or maybe -debug), you will see Ant telling you about
which property sets are ignored.

Cool.


Mime
View raw message