ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Donie <sdo...@zycor.lgc.com>
Subject RE: fail if a condition is not met?
Date Thu, 04 Jan 2001 23:43:58 GMT
Thanks - but I have several conditions I want to check at the start of a
build, and I would like to report all of the errors instead of forcing the
"fix one error, run it, find the next error, fix that..." cycle. Here's what
I have right now, which is ugly also:

  <!--
       ===================================================================
                  Checks the environment for existing resources
       ===================================================================
  -->
  <target name="check-environment"
depends="checkrmic,checkclient,checkserver">
  </target>
  
  <target name="fail-environment"
depends="check-environment,failrmic,failclient,failserver">
  </target>

  <target name="checkrmic">
    <available property="RMICManifest.present" file="RMICManifest.txt" />
  </target>
  
  <target name="failrmic" unless="RMICManifest.present">
    <fail message = "RMICManifest.txt is not present" />
  </target>
  
  <target name="checkclient">
    <available property="ClientManifest.present" file="ClientManifest.txt"
/>
  </target>

  <target name="failclient" unless="ClientManifest.present">
    <fail message = "ClientManifest.txt is not present" />
  </target>

  <target name="checkserver">
    <available property="ServerManifest.present" file="ServerManifest.txt"
/>
  </target>
  
  <target name="failserver" unless="ServerManifest.present">
    <fail message = "ServerManifest.txt is not present" />
  </target>
  
  <!--
       ===================================================================
                         Prepares the build directory
       ===================================================================
  -->
  <target name="prepare" depends="fail-environment">
    <!-- Create the time stamp -->
    <tstamp/>
    <echo message="Building ${ant.project.name} starting at ${TSTAMP} on
${TODAY}" />
    <!-- Create the directory structure used by compile -->
    <mkdir dir="${classes}" />
    <!-- cvs command="update" -->
  </target>

-----Original Message-----
From: Conor MacNeill [mailto:conor@ebinteractive.com.au]
Sent: Thursday, January 04, 2001 5:30 PM
To: ant-user@jakarta.apache.org
Subject: RE: fail if a condition is not met?


  <target name="checkTag" unless="tagname">
    <fail message="Please set tagname"/>
  </target>

Then make all your targets depend on checkTag.

--
Conor MacNeill
conor@cortexebusiness.com.au
Cortex eBusiness
http://www.cortexebusiness.com.au
-----Original Message-----
From: Steve Donie [mailto:sdonie@zycor.lgc.com]
Sent: Friday, 5 January 2001 10:24
To: Ant-User (E-mail)
Subject: fail if a condition is not met?


This seems like such a simple thing - I want my build to with an appropriate
error if certain properties aren't set. How can I do this?

Mime
View raw message