ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: if/unless Attributes
Date Fri, 25 Sep 2009 15:29:45 GMT
On 2009-09-25, Jesse Glick <> wrote:

> Refined proposal:

> 1. Make <target> evaluate if/unless attributes (just before deciding
> whether or not to run the target).

it already does (and has done so in the past).

> 2. Introduce Project.isTrueOrSet(String val) which would return true
> if toBoolean(val) || getProperty(val) != null.

PropertyHelper likely is the better place for this, otherwise I agree,
the code has to move out of Target and needs the described semantics.

Actually your toBoolean is not really boolean but follows a ternary
logic of true, false, "some other value including null".  Maybe
something like

Boolean toBoolean(Object)

and you'd want

if toBoolean(val) == Booolean.TRUE ||
    (toBoolean(val) != Boolean.FALSE && getProperty(val) != null)

so a value of "false" would really mean false.

The code in Target almost does that, with the exception that the
equivalent of toBoolean only works if val is a Boolean instance right

> 3. Call iTOS from <target>, <fail>, etc. - anything with if/unless
> attributes with the standard meaning.

Sounds good.


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

View raw message