ant-user mailing list archives

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

Here is what i did:

	... list of properties omitted ...

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

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

    <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}"/>
    </target>

	... 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.

cheers,


-----Original Message-----
From: Jay Goldman [mailto:jgoldman@iconverse.com]
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

-jay


-----Original Message-----
From: Settle, William [mailto:William.Settle@alltel.com]
Sent: Tuesday, August 13, 2002 12:04 PM
To: "ant-user@jakarta.apache.org" 
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
else
  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,
Bill

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message