ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Ayers" <may...@NEVIKNETWORKS.com>
Subject RE: Conditional target execution based on prerequisite execution
Date Wed, 19 Feb 2003 01:25:39 GMT

> From: Mike Ayers 
> Sent: Tuesday, February 18, 2003 9:02 AM

> > What is the canonical "Only create this directory if it 
> > doesn't exist" 
> > rule?
> 
> 	There may not be a canonical form, but this will work:
> 
> <condition property="dir.makeme" >
> 	<available ${dir.name} >
> </condition>
> <mkdir dir=${dir.name} />

	This was incorrect - noone noticed?  I just caught it on the reread.  Corrected:

========SNIP====8<-----------------------------------------

<!-- This must be a dependency of the top-level target, and
     must precede "MakeDirIfNecessary" in the dependency list
-->
<target name="CheckDir">
   <condition property="dir.makeme" >
      <available ${dir.name} >
   </condition>
</target>


<target name="MakeDirIfNecessary" if="dir.makeme" >
   <mkdir dir=${dir.name} />
</target>

========SNIP====8<-----------------------------------------


/|/|ike

Mime
View raw message