You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Tibor Strausz <Ti...@tridion.com> on 2002/08/15 17:18:33 UTC
if clause
i wonder how ant live would be if there would be an <if> task wich can hold
other task as its sub tasks.
the sub task gets executed when the if has a property which is true or set.
is ther shuch a task??
if not, why????
tibi
example i could do this
<!--========================================WITH IF
==================================================-->
<target name="renameSourceFolder" depends="init" description="Rename old
source folder">
<property name="moveToSrcDir"
location="${oldSrcDir}_${DSTAMP}-${TSTAMP}"/>
<property name="moveToSrcIntegrationDir"
location="${oldSrcIntegrationDir}_${DSTAMP}-${TSTAMP}"/>
<property name="moveToTDSCollectionDir"
location="${oldTDSCollectionDir}_${DSTAMP}-${TSTAMP}"/>
<available file="${oldSrcDir}" type="dir" property="oldSrcDir.present"/>
<available file="${oldSrcIntegrationDir}" type="dir"
property="oldSrcIntegrationDir.present"/>
<available file="${oldTDSCollectionDir}" type="dir"
property="oldTDSCollectionDir.present"/>
<if value="${oldSrcDir.present}">
<antcall target="moveDir">
<param name="moveToDir" value="${moveToSrcDir}"/>
<param name="oldDir" value="${oldSrcDir}"/>
</antcall>
</if>
<if value="${oldSrcIntegrationDir.present}">
<antcall target="moveDir">
<param name="moveToDir" value="${moveToSrcIntegrationDir}"/>
<param name="oldDir" value="${oldSrcIntegrationDir}"/>
</antcall>
</if>
<if value="${oldTDSCollectionDir.present}">
<antcall target="moveDir">
<param name="moveToDir" value="${moveToTDSCollectionDir}"/>
<param name="oldDir" value="${oldTDSCollectionDir}"/>
</antcall>
</if>
</target>
<!--Move Dir-->
<target name="moveDir" if="present">
<echo>Make sure the dirs and files are not locked. And the tridion
services are stoped.</echo>
<echo>Move ${oldDir} to ${moveToDir}</echo>
<move todir="${moveToDir}">
<fileset dir="${oldDir}" defaultexcludes="false"/>
</move>
</target>
<!--========================================WITHOUT IF
==================================================-->
<!--==========================-->
<!--=Rename old source folder=-->
<!--==========================-->
<target name="renameSourceFolder" depends="init" description="Rename old
source folder">
<property name="moveToSrcDir"
location="${oldSrcDir}_${DSTAMP}-${TSTAMP}"/>
<property name="moveToSrcIntegrationDir"
location="${oldSrcIntegrationDir}_${DSTAMP}-${TSTAMP}"/>
<property name="moveToTDSCollectionDir"
location="${oldTDSCollectionDir}_${DSTAMP}-${TSTAMP}"/>
<available file="${oldSrcDir}" type="dir" property="oldSrcDir.present"/>
<available file="${oldSrcIntegrationDir}" type="dir"
property="oldSrcIntegrationDir.present"/>
<available file="${oldTDSCollectionDir}" type="dir"
property="oldTDSCollectionDir.present"/>
<antcall target="moveRouter">
<param name="checkPresent" value="${oldSrcDir.present}"/>
<param name="moveToDir" value="${moveToSrcDir}"/>
<param name="oldDir" value="${oldSrcDir}"/>
</antcall>
<antcall target="moveRouter">
<param name="checkPresent" value="${oldSrcDir.present}"/>
<param name="moveToDir" value="${moveToSrcIntegrationDir}"/>
<param name="oldDir" value="${oldSrcIntegrationDir}"/>
</antcall>
<antcall target="moveRouter">
<param name="checkPresent" value="${oldTDSCollectionDir.present}"/>
<param name="moveToDir" value="${moveToTDSCollectionDir}"/>
<param name="oldDir" value="${oldTDSCollectionDir}"/>
</antcall>
</target>
<!--Move Dir Router-->
<target name="moveRouter">
<condition property="present">
<istrue value="${checkPresent}" />
</condition>
<antcall target="moveDir"/>
</target>
<!--Move Dir-->
<target name="moveDir" if="present">
<echo>Make sure the dirs and files are not locked. And the tridion
services are stoped.</echo>
<echo>Move ${oldDir} to ${moveToDir}</echo>
<move todir="${moveToDir}">
<fileset dir="${oldDir}" defaultexcludes="false"/>
</move>
</target>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: if clause
Posted by Geoff Meakin <ge...@isocra.com>.
see other thread ;) (move dir if available)
Cheers
-Geoff
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>