ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Ellsworth <sc...@alodar.com>
Subject What is wrong with this condition?
Date Mon, 13 May 2002 20:13:46 GMT
Hi, all.

I want to do a simple isset test on three critical properties, using ANT 
1.5b1.  This should be pretty straightforward with the isset option on 
condition.

   <target name="check-properties" description="Checks whether all needed 
properties have been defined">
     <condition property="missing.properties">
       <not>
         <and>
           <isset property="${allproject.dir}"/>
           <isset property="${project.name}"/>
           <isset property="${project.work.dir}"/>
         </and>
       </not>
     </condition>
   </target>

   <!-- Gives intructions on how to proceed if check is not succesful -->
   <target name="help-properties" depends="check-properties" 
if="missing.properties">
     <echo message="Not all needed properties are set."/>
     <echo message="  allproject.dir='${allproject.dir}' - The base 
directory from which all projects descend, and into which cvs puts the 
individual projects"/>
     <echo message="  project.name='${project.name}' - The name of the 
project"/>
     <echo message="  project.work.dir='${project.work.dir}' - The base 
directory where a local build file would live, and where classes are 
generated"/>
     <fail message="Not all needed properties are set."/>
   </target>

Thus, the body of help-properties will only execute if 
missing.properties is set, and that will be tested after 
check-properties is run.

if all three properties have values, then the AND is true.  The NOT 
reverses that, so the only time missing.properties will be set is if one 
is missing.

The output:

help-properties:
      [echo] Not all needed properties are set.
      [echo]   
allproject.dir='/Users/work/Documents/coding/isis/source/genetrove/persistence/
cluster_genetrove/../../..' - The base directory from which all projects 
descend, and into which cvs puts the individual projects
      [echo]   project.name='cluster_genetrove' - The base directory from 
which all projects descend, and into which cvs puts the individual 
projects
      [echo]   
project.buildfile.dir='/Users/work/Documents/coding/isis/source/genetrove/
persistence/cluster_genetrove' - The base directory from which all 
projects descend, and into which cvs puts the individual projects

So, all three look set.  What am I missing?

Scott


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