ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chen Becky" <>
Subject Use "condition" task to setup property
Date Fri, 31 Oct 2003 17:14:06 GMT

I apology that I didn't get my question clear, but you got it!
Your suggestion is exactly what I am looking for.

Thanks a lot.

-----Original Message-----
From: Robert E. Newby [] 
Sent: Friday, October 31, 2003 11:47 AM
Subject: Re: Doubt in using ENTITY

Chen Becky wrote:

> Bob (Robert E. Newby),
> Your code sample is helpful for me as well.
> I have an extra requirement that I need to setup a property with 
> different value based on some conditions.
> I wonder if I can have build-properties.xml looks like this:
>         <a>
>                 <property name="output-char" value="A"/>
>         <a/>
>         <b>
>                 <property name="output-char" value="B"/>
>         <b/>
>         <c>
>                 <property name="output-char" value="C"/>
>         <c/>
> But when I invoke "build-properties-file;" from build.xml, how can I 
> tell build-properties.xml to run only <a>, <b> or <c>? I know this
> more like XML question than ANT, any thoughts?
> Thanks.
> Becky


I am not exactly sure what you are trying to accomplish; perhaps you can
post a description of the context, etc. of your problem.

Regardless, take a look at the following snippet from one of our build


    <!-- set this property iff the condition is met, binding its value
to TRUE -->
    <condition property="setting-for-ui-in-development-mode"
      <istrue value="${ui-in-development-mode}"/>

    <!-- set this property iff the condition is met, binding its value
to FALSE -->
    <condition property="setting-for-ui-in-development-mode"
      <isfalse value="${ui-in-development-mode}"/>


This makes use of the condition task.  Here, the tested property
ui-in-development-mode might have any string literal value, since it
comes from source configuration files.  I.e., it might be "t", "true",
"y", "yes", "false", "foobar", "becky", or whatever.  Only certain of
these literals equate to true; all others equate to false.

Thus each of the above two condition elements has the effect of defining
**new** property named setting-for-ui-in-development-mode.  This new
property, which is the one we really make use of later in the build
script, will end up with the value TRUE or FALSE, depending on the
istrue and isfalse tests of the value of ui-in-development-mode.

My suggestion is that you take a look at the condition task.


Robert E. Newby

Principal Software Engineer
Vestmark, Inc.
500 Edgewater Drive, Suite 564
Wakefield, Massachusetts 01880 USA
781-224-3646 | Bob _ Newby @ vestmark . com | www . vestmark . com

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

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

View raw message