You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Francis GALIEGUE <fg...@one2team.com> on 2009/09/24 10:30:09 UTC
Feature request: ifbool/unlessbool
Hello list,
I have quite a huge build system based on ant and I govern some of its
behaviour using properties, or the lack of it thereof.
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"/>
Comments?
--
Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
fge@one2team.com
40 avenue Raymond Poincaré
75116 Paris
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Feature request: ifbool/unlessbool
Posted by Prashant Reddy <pr...@pramati.com>.
Yay! :). This is good. Thanks for sharing this information.
On 9/24/2009 3:57 PM, Stefan Bodewig wrote:
> On 2009-09-24, Francis GALIEGUE<fg...@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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Feature request: ifbool/unlessbool
Posted by Ernst de Haan <er...@pensioenpage.com>.
> 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.
This sounds like an excellent solution!
Cheers,
Ernst
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Feature request: ifbool/unlessbool
Posted by fge <fg...@one2team.com>.
On Thu, Sep 24, 2009 at 16:41, danson <da...@grafidog.com> wrote:
> Both antcontrib[1] and antelope[2] provide if/else constructs. Either
> of these would work for your situation.
>
> Dale
>
> [1] http://ant-contrib.sourceforge.net
> [2] http://antelope.tigris.org
>
>
I know this, I use ant-contrib extensively, but would like to phase it
out progressively. Antelope is not on par featurewise yet.
--
Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
fge@one2team.com
40 avenue Raymond Poincaré
75116 Paris
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Feature request: ifbool/unlessbool
Posted by danson <da...@grafidog.com>.
Both antcontrib[1] and antelope[2] provide if/else constructs. Either
of these would work for your situation.
Dale
[1] http://ant-contrib.sourceforge.net
[2] http://antelope.tigris.org
On Thu, Sep 24, 2009 at 7:37 AM, Matt Benson <gu...@yahoo.com> wrote:
>
>
> --- On Thu, 9/24/09, Stefan Bodewig <bo...@apache.org> wrote:
>
>> From: Stefan Bodewig <bo...@apache.org>
>> Subject: Re: Feature request: ifbool/unlessbool
>> To: user@ant.apache.org
>> Date: Thursday, September 24, 2009, 5:27 AM
>> On 2009-09-24, Francis GALIEGUE
>> <fg...@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.
>>
>
> I was thinking, "wow, who did that?" but as it turns out, I did it. :P
>
> -Matt
>
>> 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
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Feature request: ifbool/unlessbool
Posted by Matt Benson <gu...@yahoo.com>.
--- On Thu, 9/24/09, Stefan Bodewig <bo...@apache.org> wrote:
> From: Stefan Bodewig <bo...@apache.org>
> Subject: Re: Feature request: ifbool/unlessbool
> To: user@ant.apache.org
> Date: Thursday, September 24, 2009, 5:27 AM
> On 2009-09-24, Francis GALIEGUE
> <fg...@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.
>
I was thinking, "wow, who did that?" but as it turns out, I did it. :P
-Matt
> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Feature request: ifbool/unlessbool
Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-09-24, Francis GALIEGUE <fg...@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
Re: Feature request: ifbool/unlessbool
Posted by Prashant Reddy <pr...@pramati.com>.
+1 to this feature request.
I am curious to know. why if and unless attributes in 'target' work the
way they do, i.e only check existence of the property and not its value.
Currently ant-contrib's if tag has to be used to accomplish this sort of
control over build execution.
-Prashant
On 9/24/2009 2:00 PM, Francis GALIEGUE wrote:
> Hello list,
>
> I have quite a huge build system based on ant and I govern some of its
> behaviour using properties, or the lack of it thereof.
>
> 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"/>
>
> Comments?
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org