ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: if/unless Attributes
Date Thu, 24 Sep 2009 15:42:20 GMT
On 2009-09-24, Dominique Devienne <ddevienne@gmail.com> wrote:

> On Thu, Sep 24, 2009 at 6:32 AM, Stefan Bodewig <bodewig@apache.org> wrote:
>> the if/unless attributes for target have changes slightly in that they
>> now may use PropertyHelpers.  I.e.

>> <target if="${foo}">

>> will not be executed if ${foo} happens to expand to a Boolean instance
>> with a booleanValue() of "false" and likewise

>> <target unless="${foo}">

>> will be executed in that case.  So far this hasn't been documented, but
>> I'll do so shortly.

> That's a pretty big change.

As is the changed PropertyHelper API.  In fact Matt added that more or
less at the same time.  I just stumbled over it while trying to
understand PropertyHelper 8-)

> What's the exact semantic? Does it depend on the type returned, like
> Boolean, Object, String.

Yes, it only applies to Boolean.

> For String, does that fall back to assuming it's a property name that
> must be checked for existence?

the logic in target is:

* try to evaluate the argument (${foo}) as a property 

* if the result is a Boolean, use its booleanValue

* if it is not a Boolean, ignore it completely but instead check whether
  a property of the argument's name exists - just like in Ant 1.7.1 this
  does not expand ${foo} so it would look literally look up a property
  named ${foo}.

> What's the exact timing of the evaluation? Before or after depends' targets?

The same as before - at the start of Target#execute, i.e. it doesn't
factor into depends at all.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message