ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Feature request: ifbool/unlessbool
Date Thu, 24 Sep 2009 10:27:24 GMT
On 2009-09-24, Francis GALIEGUE <> wrote:

> But ideally, I'd like to use these properties all the time, with
> boolean values. Say, for example, if I have nomail set to 1 or true,
> then no mail is sent; if it's 0 or false, then the mail is sent. And
> the target would then read:

> <target name="junit-send-report" unlessbool="nomail"/>

Ant 1.8.0[1] and its new PropertyHelper API will help you here with the
plain if/unless attributes.

unless will pass if the property is either not set at all (current Ant
behavior) or is set and PropertyHelper expands it to Boolean.FALSE.

if will pass if the property is set to anything but Boolean.FALSE.

This only works if you are using a PropertyEvaluator that returns
Boolean instances - and there currently is none, but it would be trivial
to write one.

Check out Ant's trunk if you want to experiment with it.


[1] there still are a few details of changes in trunk that need to be
    hashed out before we can plan that release.

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

View raw message