ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject Re: Using the 'Uptodate' task
Date Thu, 14 Feb 2002 23:59:30 GMT
--- Michael J McGonagle <> wrote:
> The problem turned out that I was using 'unless="${file3.isBuilt}"' when
> it should have been 'unless="file3.isBuilt"'.
> Is it just a matter of the difference between testing for the
> 'exsistance of' and getting the 'value of'?

Nope -- 'if' and 'unless' don't test the value of a property, only whether
it's set/not-set.

> If this is the case, I can see why things were happening the way they
> were with my original code. Both times it was getting a 'true' when it
> tested for the property. On the one hand, it was true because the
> variable was not set, and in the second, it is true because its VALUE
> was true, and I was asking for its value and not its exsistance.

Nope -- you were saying "unless a property named '${file3.isBuilt}' is
set, run this target". And since a property with that (literal) name
wasn't set, your target ran. To see this try:

<!--  <property name="${foo}" value="true"/> -->
  <target name="doUnless" unless="${foo}">
    <echo message="Property $${foo} is not set."/>
  <target name="doIf" if="${foo}">
    <echo message="Property $${foo} is set."/>

$ ant doUnless doIf
     [echo] Property ${foo} is not set.

Now uncomment the <property/> and run it again. Of course, you'd never
actually want to set a property that was named '${foo}', since you'd never
be able to get at its value. (Maybe we should add some error-checking to
prevent people from doing that very thing :)



Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message