ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject Re: if/unless Attributes
Date Fri, 25 Sep 2009 14:31:28 GMT
On Fri, Sep 25, 2009 at 8:16 AM, Jesse Glick <> wrote:
> Refined proposal:
> 1. Make <target> evaluate if/unless attributes (just before deciding whether
> or not to run the target).
> 2. Introduce Project.isTrueOrSet(String val) which would return true if
> toBoolean(val) || getProperty(val) != null.
> 3. Call iTOS from <target>, <fail>, etc. - anything with if/unless
> attributes with the standard meaning.
> Now <target if="doSomething"> would behave as before, for better or worse.
> But you could also write <target if="${doSomething}"> and it would work as
> most novice Ant users would expect: run the target if doSomething is defined
> but also set to 'true' (or 'on' or 'yes'). Similarly for <fail> and friends.

I like Jesse's proposal. It fits well with the principle of least
surprise, on both
the new user front, since ${foo} is correctly interpreted in boolean cases, and
for existing users too, since the existing behavior of testing
property existence
remains. So +1 from me. Anything more is not really needed IMHO. --DD

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

View raw message