ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Goktepe <andrewgokt...@gmail.com>
Subject Re: "unless" doesn't appear to work for me?
Date Thu, 15 Sep 2005 13:52:52 GMT
Remember that all that matters is that the property is set to something. 
When you pass <param name="file.exists" value="${file.exists}"/>, you are 
setting that parameter for the target you are calling. This means that if 
file.exists has not been defined previously, you have just set it to the 
value "${file.exists}", and from that point forward the property has a 
value. This causes the if/unless behavior you are seeing. 
 You shouldn't have to specify the file.exists property as a parameter at 
all. Once you set it during the main target, it will be available to the 
checkout and update targets as well. (the default value of antcall's 
'inheritAll' attribute is true). 
 -Andrew

 On 9/15/05, Greg Akins <gakins@insomnia-consulting.org> wrote: 
> 
> Quoting Dominique Devienne <ddevienne@gmail.com>:
> 
> > 1) Thinking if="foo" means "execute the target is foo's property value
> > is true (or yes, or 1)". It sounds like you're are not making that
> > mistake.
> >
> 
> Here is the target I'm running (this is the only target in this buildfile, 
> and
> fileToCheck & destination are getting passed correctly).
> 
> I didn't necessarily think that if="foo" meant that it had to be true, 
> just that
> it had to be set.
> 
> However, if file.exists isn't set <echo message="${file.exists}/> prints
> ${file.exists} then checkout does not run, and update still does
> 
> 
> 
> <target name="main" >
> <condition property="file.exists">
> <length file="${fileToCheck}" when="greater" length="0"/>
> </condition>
> 
> <echo message="File Exists ${file.exists}" />
> 
> <antcall target="checkout">
> <param name="destination" value="${destination}"/>
> <param name="file.exists" value="${file.exists}" />
> </antcall>
> <antcall target="update">
> <param name="destination" value="${destination}"/>
> <param name="file.exists" value="${file.exists}" />
> </antcall>
> 
> </target>
> <target name="checkout" unless="file.exists" >
> <echo message="svn co
> https://svn.forge.amervideo.com/svn/systems/cim/atlas/${destination}
> ${destination}" />
> <exec executable="svn" >
> <arg line="co
> https://svn.forge.amervideo.com/svn/systems/cim/atlas/${destination}
> ${destination}" />
> </exec>
> </target>
> <target name="update" if="file.exists" >
> <echo message="svn update ${destination}" />
> <exec executable="svn" >
> <arg line="co
> https://svn.forge.amervideo.com/svn/systems/cim/atlas/${destination}
> ${destination}" />
> </exec>
> </target>
> 
> -------------------------------------------------
> This mail sent through IMP: http://horde.org/imp/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message