ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Buonassisi, Vincent" <>
Subject RE: Conditional processing
Date Fri, 16 Aug 2002 18:11:21 GMT

Here is what i did:

	... list of properties omitted ...

    <target name="validate_rel_dir">
        <condition property="release_no_set">
            <isset property="release_no"/>
        <available file="${RELEASE_DIR}" type="dir"

    <target name="validate_user">
        <condition property="user_validated">
            <equals arg1="${APPL_USER_ID}" arg2="${}"/>

    <target name="validate" depends="validate_user, validate_rel_dir">
        <fail unless="user_validated" message="ERROR: Invalid user running
this script."/>
        <fail unless="release_no_set" message="${nl}${nl}ERROR: Invalid
number of parameters.  Need to pass the release number (e.g., 3_0)."/>
        <fail if="rel_dir_exists" message="${nl}${nl}${tab}ERROR: Release
already exists, please remove directory first:   ${RELEASE_DIR}"/>

	... other stuff ...

    <target name="build" depends="info_msg, validate, cvs_checkout"/>

this will check to see if the correct user id is building the code, and if
the release diectory exists and if the release_no was passed in on the
command line.

hopefully this will help.


-----Original Message-----
From: Jay Goldman []
Sent: Friday, August 16, 2002 10:58 AM
To: Ant Users List
Subject: RE: Conditional processing

look at the 'if' and 'unless' attributes on targets


-----Original Message-----
From: Settle, William []
Sent: Tuesday, August 13, 2002 12:04 PM
To: "" 
Subject: Conditional processing

I am looking for a way to test if a property is set and if so, do one
thing.  If
it is not set, then do another.  Something like

if property set
  do something
  do something else

It looks like using the <condition> tag with the <isset> tag might work
but I
can't figure out how to make it work.

I would appreciate any help you can give,

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

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

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

View raw message