<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="main" name="Create Runnable Jar for Project p4convert.dev">
<!--PROPERTIES-->
<property name="main.class" value="com.perforce.svn.Main" />
<property name="integ.class" value="com.perforce.integration.IntegrationTests" />
<property name="import.class" value="com.perforce.integration.ImportTests" />
<property name="cvs_integ.class" value="com.perforce.cvs.integration.CvsIntegrationTests" />
<property name="cvs_import.class" value="com.perforce.cvs.integration.CvsImportTests" />
<property name="src.dir" value="src" />
<property name="test.dir" value="test" />
<property name="bin.dir" value="bin" />
<property name="dist.dir" value="dist" />
<property name="release.dir" value="release" />
<property name="ext.dir" value="ext" />
<property name="prop.dir" value="prop" />
<property name="jar.name" value="p4convert-svn" />
<property name="manifest.name" value="MANIFEST.MF" />
<property name="junit.dir" value="junit" />
<property name="p4java.ver" value="p4java-2013.2.858003.MAIN-TEST_ONLY-SNAPSHOT" />
<property name="version" value="ENGINEERING.BUILD.${user.name}" />
<path id="classpath">
<fileset dir="${ext.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<!--RULE: clean project-->
<target name="clean">
<delete dir="${bin.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${junit.dir}" />
<delete dir="${release.dir}" />
</target>
<!--RULE: check args for version string-->
<target name="test-ver" unless="version">
<fail message="missing version argument: -Dversion=REL.NAME.PATCH" />
</target>
<!--MANIFEST file-->
<target name="manifest" depends="compile.jar">
<manifest file="${manifest.name}">
<attribute name="Main-Class" value="${main.class}" />
<attribute name="Class-Path" value="." />
<attribute name="Specification-Title" value="P4 Convert (Subversion)" />
<attribute name="Specification-Version" value="${version}" />
<attribute name="Specification-Vendor" value="Perforce Software" />
<attribute name="Implementation-Title" value="${jar.name}.jar" />
<attribute name="Implementation-Version" value="${version}" />
<attribute name="Implementation-Vendor" value="Perforce Software" />
</manifest>
</target>
<!--RULE: compile java source (without tests)-->
<target name="compile.jar">
<mkdir dir="${bin.dir}" />
<javac srcdir="${src.dir}" destdir="${bin.dir}" classpathref="classpath" debug="true" includeantruntime="false" />
</target>
<!--RULE: build release jar-->
<target name="release.jar" depends="compile.jar, manifest, test-ver">
<mkdir dir="${release.dir}" />
<jar destfile="${release.dir}/${version}/${jar.name}.jar" basedir="${bin.dir}" manifest="${manifest.name}">
<fileset dir="${bin.dir}" />
<fileset dir="${prop.dir}" />
<zipfileset excludes="META-INF/*.SF" src="${ext.dir}/${p4java.ver}/${p4java.ver}.jar" />
<zipfileset excludes="META-INF/*.SF" src="${ext.dir}/icu4j-51_2.jar" />
<zipfileset excludes="META-INF/*.SF" src="${ext.dir}/slf4j-api-1.6.6.jar" />
<zipfileset excludes="META-INF/*.SF" src="${ext.dir}/slf4j-log4j12-1.6.6.jar" />
<zipfileset excludes="META-INF/*.SF" src="${ext.dir}/log4j-1.2.17.jar" />
</jar>
</target>
<!--RULE: build release-->
<target name="release" depends="release.jar, test-ver, run">
<mkdir dir="${release.dir}/${version}" />
<copy file="p4convert-svn.html" todir="${release.dir}/${version}" />
<copy file="default.cfg" todir="${release.dir}/${version}" />
<copy file="types.map" todir="${release.dir}/${version}" />
<copy file="debug.log4j.xml" todir="${release.dir}/${version}" />
<copy file="p4convert-notes.txt" todir="${release.dir}/${version}" />
<tar destfile="${release.dir}/${jar.name}.tar">
<tarfileset dir="${release.dir}/${version}/.." filemode="644">
<include name="${version}/**" />
</tarfileset>
</tar>
<gzip src="${release.dir}/${jar.name}.tar" destfile="${release.dir}/${jar.name}.tgz" />
<delete dir="${release.dir}/${version}" />
<delete file="${release.dir}/${jar.name}.tar" />
</target>
<!--RULE: compile java source-->
<target name="compile">
<mkdir dir="${bin.dir}" />
<javac srcdir="${src.dir}" destdir="${bin.dir}" classpathref="classpath" debug="true" includeantruntime="false" />
<javac srcdir="${test.dir}" destdir="${bin.dir}" classpathref="classpath" debug="true" includeantruntime="false" />
</target>
<!--RULE: build jar-->
<target name="jar" depends="compile, manifest">
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/${jar.name}.jar" basedir="${bin.dir}" manifest="${manifest.name}">
<fileset dir="${bin.dir}" />
<fileset dir="${prop.dir}" />
<zipfileset excludes="META-INF/*.SF" src="${ext.dir}/org.junit_4.8.1.v4_8_1_v20100427-1100/junit.jar" />
<zipfileset excludes="META-INF/*.SF" src="${ext.dir}/org.hamcrest.core_1.1.0.v20090501071000.jar" />
<zipfileset excludes="META-INF/*.SF" src="${ext.dir}/${p4java.ver}/${p4java.ver}.jar" />
<zipfileset excludes="META-INF/*.SF" src="${ext.dir}/icu4j-51_2.jar" />
<zipfileset excludes="META-INF/*.SF" src="${ext.dir}/slf4j-api-1.6.6.jar" />
<zipfileset excludes="META-INF/*.SF" src="${ext.dir}/slf4j-log4j12-1.6.6.jar" />
<zipfileset excludes="META-INF/*.SF" src="${ext.dir}/log4j-1.2.17.jar" />
</jar>
</target>
<!--RULE: run generated jar-->
<target name="run" depends="jar">
<java fork="true" classname="${main.class}">
<classpath>
<path id="svn2p4.cli.id" location="${dist.dir}/${jar.name}.jar" />
</classpath>
<jvmarg value="-Dfile.encoding=UTF-8" />
<arg line="--config SVN" />
</java>
</target>
<!--RULE: check args for individual tests-->
<target name="test-arg" unless="case">
<fail message="missing argument: -Dcase=TestName" />
</target>
<!--RULE: back door tests-->
<target name="back" depends="jar, test-arg">
<echo message="Running testcase: ${case}" />
<mkdir dir="${junit.dir}" />
<junit fork="yes" printsummary="yes" haltonfailure="no">
<classpath>
<path id="svn2p4.test.id" location="${dist.dir}/${jar.name}.jar" />
</classpath>
<jvmarg value="-Dfile.encoding=UTF-8" />
<test name="${integ.class}" methods="case${case}" todir="${junit.dir}" />
<formatter type="plain" usefile="false" />
</junit>
</target>
<!--RULE: front door tests-->
<target name="front" depends="jar, test-arg">
<echo message="Running testcase: ${case}" />
<mkdir dir="${junit.dir}" />
<junit fork="yes" printsummary="yes" haltonfailure="no">
<classpath>
<path id="svn2p4.test.id" location="${dist.dir}/${jar.name}.jar" />
</classpath>
<jvmarg value="-Dfile.encoding=UTF-8" />
<test name="${import.class}" methods="case${case}" todir="${junit.dir}" />
<formatter type="plain" usefile="false" />
</junit>
</target>
<!--RULE: front door tests-->
<target name="cvs-front" depends="jar, test-arg">
<echo message="Running testcase: ${case}" />
<mkdir dir="${junit.dir}" />
<junit fork="yes" printsummary="yes" haltonfailure="no">
<classpath>
<path id="cvs2p4.test.id" location="${dist.dir}/${jar.name}.jar" />
</classpath>
<jvmarg value="-Dfile.encoding=UTF-8" />
<test name="${cvs_import.class}" methods="case${case}" todir="${junit.dir}" />
<formatter type="plain" usefile="false" />
</junit>
</target>
<!--RULE: back door tests-->
<target name="cvs-back" depends="jar, test-arg">
<echo message="Running testcase: ${case}" />
<mkdir dir="${junit.dir}" />
<junit fork="yes" printsummary="yes" haltonfailure="no">
<classpath>
<path id="cvs2p4.test.id" location="${dist.dir}/${jar.name}.jar" />
</classpath>
<jvmarg value="-Dfile.encoding=UTF-8" />
<test name="${cvs_integ.class}" methods="case${case}" todir="${junit.dir}" />
<formatter type="plain" usefile="false" />
</junit>
</target>
<!--RULE: junit tests-->
<target name="junit" depends="jar">
<mkdir dir="${junit.dir}" />
<junit fork="yes" printsummary="yes" haltonfailure="no" showoutput="no" failureproperty="junit.ok">
<classpath>
<path id="svn2p4.junit.id" location="${dist.dir}/${jar.name}.jar" />
</classpath>
<jvmarg value="-Dfile.encoding=UTF-8" />
<test name="com.perforce.cvs.integration.CvsIntegrationTests" todir="${junit.dir}" />
<test name="com.perforce.cvs.integration.CvsImportTests" todir="${junit.dir}" />
<test name="com.perforce.integration.IntegrationTests" todir="${junit.dir}" />
<test name="com.perforce.svndump.history.TestRevisionTree" todir="${junit.dir}" />
<test name="com.perforce.svndump.parser.TestSchema" todir="${junit.dir}" />
<test name="com.perforce.svndump.prescan.TestExtractRecord" todir="${junit.dir}" />
<test name="com.perforce.svndump.prescan.TestUsage" todir="${junit.dir}" />
<test name="com.perforce.integration.ImportTests" todir="${junit.dir}" />
<formatter type="xml" />
</junit>
<junitreport todir="${junit.dir}">
<fileset dir="${junit.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${junit.dir}" />
</junitreport>
<fail if="junit.ok" message="Unit test(s) failed. See reports!" />
</target>
<!--RULE: junit tests-->
<target name="svn" depends="jar">
<mkdir dir="${junit.dir}" />
<junit fork="yes" printsummary="yes" haltonfailure="no" showoutput="no" failureproperty="junit.ok">
<classpath>
<path id="svn2p4.junit.id" location="${dist.dir}/${jar.name}.jar" />
</classpath>
<jvmarg value="-Dfile.encoding=UTF-8" />
<test name="com.perforce.integration.IntegrationTests" todir="${junit.dir}" />
<test name="com.perforce.integration.ImportTests" todir="${junit.dir}" />
<formatter type="xml" />
</junit>
<junitreport todir="${junit.dir}">
<fileset dir="${junit.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${junit.dir}" />
</junitreport>
<fail if="junit.ok" message="Unit test(s) failed. See reports!" />
</target>
<!--RULE: junit tests-->
<target name="cvs" depends="jar">
<mkdir dir="${junit.dir}" />
<junit fork="yes" printsummary="yes" haltonfailure="no" showoutput="no" failureproperty="junit.ok">
<classpath>
<path id="svn2p4.junit.id" location="${dist.dir}/${jar.name}.jar" />
</classpath>
<jvmarg value="-Dfile.encoding=UTF-8" />
<test name="com.perforce.cvs.integration.CvsIntegrationTests" todir="${junit.dir}" />
<test name="com.perforce.cvs.integration.CvsImportTests" todir="${junit.dir}" />
<formatter type="xml" />
</junit>
<junitreport todir="${junit.dir}">
<fileset dir="${junit.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${junit.dir}" />
</junitreport>
<fail if="junit.ok" message="Unit test(s) failed. See reports!" />
</target>
<!--RULE: default-->
<target name="main" depends="jar" />
</project>