<?xml version="1.0" encoding="UTF-8"?>
<!-- Written to assume that classpath is rooted in the current directory. -->
<!-- So this should be OK if you make this script in the root of a filesystem. -->
<!-- If not, you may prefer to adjust the basedir, or move some directories around. -->
<!-- The idea is that both Ant and NetBeans have to know what the package root is -->
<!-- for the classes in your application. -->
<project basedir="h:\cvs_work\perforce" default="compile_for_release" name="myapp">

    <target name="init">
        <!-- You can set up any variables you want used throughout the script here. -->
        <property name="root.dir" value="h:\cvs_work\perforce"/>
        <property name="classes.dir" value="${root.dir}\classes"/>
        <property name="src.dir" value="${root.dir}\src"/>
        <property name="p4.jar" value="${root.dir}\lib\p4.jar"/>
        <property name="jar.file" value="${root.dir}\bin\tp4branchview.jar"/>
        <property name="resources.dir" value="${root.dir}\resources"/>
        <property name="copy.jar.dest" value="G:\programme\perforce\tp4branchview.jar"/>
        <property name="copy.jar.eclipse" value="H:\cvs_work\EclipseP4BranchView\tp4branchview.jar"/>
        <property name="copy.jar.plugins" value="G:\eclipse\plugins\de.loskutov.eclipse.bvwrapper\tp4branchview.jar"/>
        <property name="plugins.dir" value="G:\eclipse\plugins\de.loskutov.eclipse.bvwrapper"/>
        <property name="dist.dir" value="H:\cvs_work\public_depot\guest\andrei_loskutov"/>
        <property name="dist.jar" value="H:\cvs_work\public_depot\guest\andrei_loskutov\tp4branchview.jar"/>
        <property name="homepage.dir" value="H:\cvs_work\homepage\perforce"/>
        <property name="homepage.zip" value="${homepage.dir}\branchview.zip"/>
        <property name="homepage.jar" value="${homepage.dir}\tp4branchview.jar"/>
        <property name="bvwrapper.zip" value="${homepage.dir}\bvwrapper.zip"/>
        <property name="public.zip" value="H:\cvs_work\public_depot\guest\andrei_loskutov\branchview.zip"/>
        <property name="homepage.docu" value="${homepage.dir}\branchview_docu.zip"/>
        <property name="homepage.src" value="${homepage.dir}\branchview_src.zip"/>
        <!-- To use e.g. Jikes, uncomment this line. -->
        <!-- <property name="src.dir" value="${root.dir}\src"/> -->
        <!-- <property name="build.compiler" value="jikes"/> -->
        <!-- You might like to set up some overridable paths, etc.: -->
        <!-- <property name="mylib" value="../lib/mylib.jar"/> -->
    </target>

    <target name="compile" depends="init" description="Compile everything." >
        <javac debug="true" optimize="false" deprecation="true" destdir="${classes.dir}">
			<classpath>
				<pathelement location="${p4.jar}"/>
                <pathelement location="G:\eclipse\plugins\org.eclipse.ui.workbench_2.1.0\workbench.jar"/>
				<pathelement location="G:\eclipse\plugins\org.eclipse.swt.win32_2.1.0\ws\win32\swt.jar"/>
				<pathelement location="G:\eclipse\plugins\net.sourceforge.perforce.ui_0.6.0\p4ui.jar"/>
				<pathelement location="G:\eclipse\plugins\org.eclipse.jface_2.1.0\jface.jar"/>
				<pathelement location="G:\eclipse\plugins\org.eclipse.compare_2.1.0\compare.jar"/>
				<pathelement location="G:\eclipse\plugins\org.eclipse.core.runtime_2.1.0\runtime.jar"/>
				<pathelement location="G:\eclipse\plugins\de.loskutov.eclipse.bvwrapper\p4branchview.jar"/>
			</classpath>
            <src path="${src.dir}/Acme"/>
            <src path="${src.dir}/adiag"/>
        </javac>
    </target>

    <target name="compile_for_release" depends="init" description="Compile everything.">
        <javac debug="false" optimize="true" deprecation="true" destdir="${classes.dir}">
			<classpath>
				<pathelement location="${p4.jar}"/>
                <pathelement location="G:\eclipse\plugins\org.eclipse.ui.workbench_2.1.0\workbench.jar"/>
				<pathelement location="G:\eclipse\plugins\org.eclipse.swt.win32_2.1.0\ws\win32\swt.jar"/>
				<pathelement location="G:\eclipse\plugins\net.sourceforge.perforce.ui_0.6.0\p4ui.jar"/>
				<pathelement location="G:\eclipse\plugins\org.eclipse.jface_2.1.0\jface.jar"/>
				<pathelement location="G:\eclipse\plugins\org.eclipse.compare_2.1.0\compare.jar"/>
				<pathelement location="G:\eclipse\plugins\org.eclipse.core.runtime_2.1.0\runtime.jar"/>
				<pathelement location="G:\eclipse\plugins\de.loskutov.eclipse.bvwrapper\p4branchview.jar"/>

			</classpath>
            <src path="${src.dir}/Acme"/>
            <src path="${src.dir}/adiag"/>
        </javac>
    </target>

    <target name="p4compile" depends="init" description="Compile everything.">
        <javac debug="true" optimize="true" deprecation="true" destdir="${classes.dir}">
			<classpath>
				<pathelement location="${p4.jar}"/>
                <pathelement location="G:\eclipse\plugins\org.eclipse.ui.workbench_2.1.0\workbench.jar"/>
				<pathelement location="G:\eclipse\plugins\org.eclipse.swt.win32_2.1.0\ws\win32\swt.jar"/>
				<pathelement location="G:\eclipse\plugins\net.sourceforge.perforce.ui_0.6.0\p4ui.jar"/>
				<pathelement location="G:\eclipse\plugins\org.eclipse.jface_2.1.0\jface.jar"/>
				<pathelement location="G:\eclipse\plugins\org.eclipse.compare_2.1.0\compare.jar"/>
				<pathelement location="G:\eclipse\plugins\org.eclipse.core.runtime_2.1.0\runtime.jar"/>
				<pathelement location="G:\eclipse\plugins\de.loskutov.eclipse.bvwrapper\p4branchview.jar"/>
			</classpath>
            <src path="${src.dir}/Acme"/>
            <src path="${src.dir}/adiag"/>
            <src path="${src.dir}/com"/>
        </javac>
    </target>


    <target name="jar" depends="init,compile" description="Jar everything.">
        <copy file="${resources.dir}/todo.txt" tofile="${classes.dir}/todo.txt"/>
        <jar basedir="${classes.dir}" compress="true" jarfile="${jar.file}" manifest="${src.dir}/MANIFEST.MF">
            <exclude name="**/*.java"/>
            <exclude name="com/**/*"/>
            <exclude name="**/p4api/*"/>
            <exclude name="**/*.form"/>
        </jar>
        <copy file="${copy.jar.dest}" tofile="${copy.jar.dest}.old"/>
        <copy file="${jar.file}" tofile="${copy.jar.dest}"/>
        <copy file="${jar.file}" tofile="${copy.jar.eclipse}"/>
        <copy file="${jar.file}" tofile="${copy.jar.plugins}"/>
    </target>

    <target name="jar_release" depends="init,compile_for_release" description="Jar everything.">
        <copy file="${resources.dir}/todo.txt" tofile="${classes.dir}/todo.txt"/>
        <jar basedir="${classes.dir}" compress="true" jarfile="${jar.file}" manifest="${src.dir}/MANIFEST.MF">
            <exclude name="**/*.java"/>
            <exclude name="com/**/*"/>
            <exclude name="**/p4api/*"/>
            <exclude name="**/*.form"/>
        </jar>
        <copy file="${copy.jar.dest}" tofile="${copy.jar.dest}.old"/>
        <copy file="${jar.file}" tofile="${copy.jar.dest}"/>
        <copy file="${jar.file}" tofile="${copy.jar.eclipse}"/>
        <copy file="${jar.file}" tofile="${copy.jar.plugins}"/>
        <copy file="${jar.file}" tofile="${homepage.jar}"/>
    </target>

    <target name="zip_release" depends="clean,jar_release" description="Zip everything." >

        <jar basedir="${homepage.dir}" compress="true" jarfile="${homepage.zip}" >
            <exclude name="**/*.gif"/>
            <exclude name="**/*.zip"/>
            <exclude name="de/**/*"/>
            <exclude name="_notes/**/*"/>
            <include name="*.htm*"/>
            <include name="en/**/*.htm*"/>
            <include name="**/*.css"/>
            <include name="*.txt"/>
            <include name="tp4branchview.jar"/>
        </jar>
        <jar basedir="${homepage.dir}" compress="true" jarfile="${homepage.docu}" >
            <include name="**/*.gif"/>
            <exclude name="**/*.zip"/>
            <exclude name="de/**/*"/>
            <exclude name="_notes/**/*"/>
            <include name="*.htm*"/>
            <include name="en/**/*.htm*"/>
            <include name="**/*.css"/>
            <include name="*.txt"/>
        </jar>
        <jar basedir="${src.dir}" compress="true" jarfile="${homepage.src}" >
            <include name="**/*.java"/>
            <exclude name="com/**/*"/>
        </jar>
        <ant antfile="build_plugin.xml" dir="h:\cvs_work\EclipseP4BranchView" inheritAll="false" target="zip_release"/>
        <copy file="${homepage.zip}" tofile="${public.zip}"/>
        <copy file="${jar.file}" tofile="${homepage.jar}"/>
    </target>

    <target name="P4jar" depends="init,p4compile" description="Jar everything.">
        <copy todir="${classes.dir}" >
            <fileset dir="${resources.dir}" >
              <exclude name="**/*.java" />
            </fileset>
        </copy>
        <jar basedir="${classes.dir}" compress="true" jarfile="${jar.file}" manifest="${src.dir}/MANIFEST.MF">
            <exclude name="**/*.java"/>
            <exclude name="**/*.form"/>
        </jar>
        <copy file="${copy.jar.dest}" tofile="${copy.jar.dest}.old"/>
        <copy file="${jar.file}" tofile="${copy.jar.dest}"/>
    </target>

    <target name="javadoc" depends="init" description="Javadoc for my API.">
        <mkdir dir="doc"/>
        <javadoc destdir="apidoc" packagenames="com.foo.mylib.*,com.foo.myapi.*">
            <sourcepath>
                <pathelement location="."/>
            </sourcepath>
        </javadoc>
    </target>

    <target name="clean" depends="init" description="Clean all build products.">
        <delete>
            <fileset dir="${classes.dir}">
                <include name="**/*.class"/>
            </fileset>
        </delete>
    </target>

    <!--<delete file="myapp.jar"/>
        <delete dir="apidoc"/>-->
        <!-- <copy todir="${classes.dir}" >
            <fileset dir="${resources.dir}" >
              <exclude name="**/*.java" />
            </fileset>
        </copy> -->

</project>
