ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Feature request: ifbool/unlessbool
Date Thu, 24 Sep 2009 10:27:24 GMT
On 2009-09-24, Francis GALIEGUE <fge@one2team.com> 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.

Stefan

[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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message