<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="./wfrant2html.xsl"?>
<!-- version 2005/09/19 -->
<!-- author Bill Rich, bill@wilandra.com, Wilandra Consulting LLC. Copyright (C) 2004-2005, Wilandra Consulting LLC. All rights reserved. -->
<!-- =================================================================== -->
<project	name="LevTools-p4tasks"
					basedir="."
					default="init"
					xmlns:ac="antlib:net.sf.antcontrib">
	<description>
		Ant tasks used in an L10N project for a webMethods product to perform operations in Perforce. This is intended to be imported by the L10NProcess-tasks.xml file. The targets in this file are useful only to the targets in the other L10NProcess files. These targets are not intended to be used as main tasks.
	</description>
<!-- =================================================================== -->
	<target	name="get"
					depends="init-ext, loadprojxlfilelist, syncsrcfiles, copysrcfiles"
					if="projXLFileList"
					description="Get the source files from the Perforce client depot based on list of files in the ExtSamp project file.">
	</target>
<!-- =================================================================== -->
	<target	name="syncsrcfiles"
					if="projXLFileList"
					description="Issue the P4 Sync command for the source files based on the list of files in the LevTools project file.">
		<ac:for	list="${projXLFileList}"
					delimiter=";"
					param="srcfile">
			<sequential>
				<getsrcname	listitem="@{srcfile}"
										property="file.ssf.@{srcfile}"/>
				<p4sync	port="${P4PORT}"
								client="${P4CLIENT}"
								user="${P4USER}"
								view="${P4DEPOT}/${PRODUCT}/${file.ssf.@{srcfile}}"/>
			</sequential>
		</ac:for>
	</target>
<!-- =================================================================== -->
	<target	name="checkin"
					depends="init-ext, loadprojxlfilelist"
					if="projXLFileList"
					description="Check in the target files shown in the project control file to the Perforce source code control system.">
		<ac:for	list="${projXLFileList}"
					delimiter=";"
					param="targetfile">
			<sequential>
				<getoutputname	listitem="@{targetfile}"
												property="file.ci.@{targetfile}"/>
				<available	file="${P4DEPOT}/${PRODUCT}/${file.ci.@{targetfile}}"
										property="checkin.file.exists.${P4DEPOT}/${PRODUCT}/${file.ci.@{targetfile}}"/>
				<ac:if>
					<isset property="checkin.file.exists.${P4DEPOT}/${PRODUCT}/${file.ci.@{targetfile}}"/>
					<then>
						<p4sync	port="${P4PORT}"
								client="${P4CLIENT}"
								user="${P4USER}"
								view="${P4DEPOT}/${PRODUCT}/${file.ci.@{targetfile}}"/>
						<p4edit	port="${P4PORT}"
								client="${P4CLIENT}"
								user="${P4USER}"
								view="${P4DEPOT}/${PRODUCT}/${file.ci.@{targetfile}}"/>
						<copy	tofile="${P4DEPOT}/${PRODUCT}/${file.ci.@{targetfile}}"
								file="${PRODUCT}/${file.ci.@{targetfile}}" overwrite="true"/>
						<property	name="p4edit-was-run"
									value="yes"/>
					</then>
					<else>
						<copy	tofile="${P4DEPOT}/${PRODUCT}/${file.ci.@{targetfile}}"
								file="${PRODUCT}/${file.ci.@{targetfile}}"/>
						<p4add	port="${P4PORT}"
								client="${P4CLIENT}"
								user="${P4USER}">
							<fileset	dir="${P4DEPOT}">
								<include	name="${PRODUCT}/${file.ci.@{targetfile}}"/>
							</fileset>
						</p4add>
					</else>
				</ac:if>
			</sequential>
		</ac:for>
		<antcall	target="revert"/>
	</target>
<!-- =================================================================== -->
	<target	name="revert"
					if="p4edit-was-run"
					description="Revert unchanged target files.">
		<p4revert	port="${P4PORT}"
							client="${P4CLIENT}"
							user="${P4USER}"
							view="${P4DEPOT}/${PRODUCT}/..."
							change="default"
							revertonlyunchanged="true"/>
	</target>
<!-- =================================================================== -->
</project>
