<?xml version="1.0"?>

<!--
    $RCSfile: build.xml,v $
    $Revision: 3880 $
    $Date: 2006-05-11 03:39:25 -0300 (Thu, 11 May 2006) $

    This software is published under the terms of the GNU Public License (GPL),
    a copy of which is included in this distribution.
-->

<!--
    Build Requirements:

        * Ant 1.6 (including optional tasks)
        * JDK 1.5
        * jUnit in your Ant or Java classpath
-->

<project name="Connection Manager" default="all" basedir="..">

    <description>
        Connection Manager build script.
    </description>

    <!-- ======================================================================================= -->
    <!-- GLOBAL TASKDEFs                                                                         -->
    <!-- ======================================================================================= -->

    <taskdef resource="net/sf/antcontrib/antcontrib.properties">
        <classpath>
            <pathelement location="${basedir}/build/lib/ant-contrib.jar"/>
        </classpath>
    </taskdef>
    <taskdef name="subdirinfo" classname="org.jivesoftware.ant.SubDirInfoTask">
        <classpath>
            <pathelement location="${basedir}/build/lib/ant-subdirtask.jar"/>
        </classpath>
    </taskdef>
    <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
        <classpath>
            <pathelement location="${basedir}/build/lib/xmltask.jar"/>
        </classpath>
    </taskdef>
   <taskdef name="pack200" classname="com.sun.tools.apache.ant.pack200.Pack200Task">
       <classpath>
           <pathelement location="${basedir}/build/lib/pack200task.jar"/>
       </classpath>
   </taskdef>
   <taskdef name="unpack200" classname="com.sun.tools.apache.ant.pack200.Unpack200Task">
     <classpath>
           <pathelement location="${basedir}/build/lib/pack200task.jar"/>
       </classpath>
   </taskdef>

    <!--
    <taskdef resource="clovertasks" />
    -->

    <!-- ======================================================================================= -->
    <!-- GLOBAL PROPERTIES                                                                       -->
    <!-- ======================================================================================= -->

    <property name="version.major" value="3"/>
    <property name="version.minor" value="5"/>
    <property name="version.revision" value="0"/>
    <property name="version.extra" value=""/> <!-- For 'beta' or 'alpha' -->
    <property name="dist.prefix" value="connection_manager"/>

    <property file="${basedir}/build/build.properties"/>

    <property name="src.dir" value="${basedir}/src"/>
    <property name="src.java.dir" value="${src.dir}/java"/>
    <property name="src.i18n.dir" value="${src.dir}/i18n"/>
    <property name="src.test.dir" value="${src.dir}/test"/>
    <property name="src.test.java.dir" value="${src.test.dir}/java"/>
    <property name="docs.dir" value="${basedir}/documentation"/>
    <property name="lib.build.dir" value="${basedir}/build/lib"/>
    <property name="lib.build.installer.dir" value="${basedir}/build/installer"/>
    <property name="lib.merge.dir" value="${lib.build.dir}/merge"/>
    <property name="lib.dist.dir" value="${lib.build.dir}/dist"/>
    <property name="i18n.basename" value="cmanager_i18n"/>
    <property name="i18n.default.locale" value="en"/>
    <property name="target.dir" value="${basedir}/target"/>
    <property name="temp.build.dir" value="${basedir}/target/tempbuild"/>
    <property name="target.i18n.dir" value="${temp.build.dir}/i18n"/>
    <property name="compile.dir" value="${target.dir}/classes"/>
    <property name="jar.name" value="cmanager.jar"/>
    <property name="jar.starter.name" value="startup.jar"/>
    <property name="jar.dest.dir" value="${target.dir}/lib"/>
    <property name="javadoc.src.dir" value="${src.dir}/javadoc"/>
    <property name="javadoc.dest.dir" value="${target.dir}/javadoc"/>
    <property name="test.dest.dir" value="${target.dir}/test"/>
    <property name="test.classes.dest.dir" value="${test.dest.dir}/classes"/>
    <property name="test.results.dest.dir" value="${test.dest.dir}/results"/>
    <property name="release.dest.dir" value="${target.dir}/release"/>
    <property name="overwrite" value="false"/>
    <property name="deploy.jar.dir" value="${jar.dest.dir}"/>
    <property name="anttools.src.dir" value="${src.dir}/tools"/>
    <property name="anttools.target.dir" value="${target.dir}/tools"/>
    <property name="overwrite" value="true"/>

    <property name="installer.install4j.home" value="c:\\Program Files\\install4j"/>
    <property name="installer.src" value="${basedir}/build/installer"/>
    <property name="installer.dest.dir" value="${release.dest.dir}/installers"/>
    <property name="installer.install4j.srcfile" value="${installer.src}/cmanager.install4j"/>
    <property name="installer.app_name" value="Connection Manager"/>
    <property name="installer.app_short_name" value="connection_manager"/>
    <property name="installer.product_name" value="connection_manager"/>
    <property name="installer.application_id" value="6886-9911-0474-3571"/>
    <property name="installer.unix_install_dir" value="connection_manager"/>
    <property name="installer.windows_install_dir" value="Connection Manager"/>
    <property name="installer.publisher" value="Jive Software"/>
    <property name="installer.publisher_url" value="www.igniterealtime.org"/>
    <property name="installer.file_prefix" value="${installer.app_short_name}"/>
    <property name="installer.release_root_path" value="${release.dest.dir}"/>

    <property name="license.file.path" value="${docs.dir}/dist"/>

    <!-- For auto-running and debugging -->
    <property name="debug" value="false" />

    <!-- ======================================================================================= -->
    <!-- PATHs / PATTERNSETs / FILTERSETs                                                        -->
    <!-- ======================================================================================= -->

    <path id="javadoc.dependencies">
        <fileset dir="${lib.build.dir}" includes="*.jar" excludes="junit.jar"/>
        <fileset dir="${lib.merge.dir}" includes="*.jar"/>
        <fileset dir="${lib.dist.dir}" includes="servlet.jar, mail.jar, activation.jar, jdic.jar, bouncycastle.jar"/>
    </path>

    <path id="compile.dependencies">
        <path refid="javadoc.dependencies"/>
    </path>

    <path id="test.dependencies">
        <path refid="compile.dependencies"/>
        <fileset dir="${jar.dest.dir}" includes="cmanager.jar"/>
        <fileset dir="${lib.build.dir}" includes="junit.jar"/>
        <!-- <fileset dir="${ant.home}/lib" includes="clover.jar" /> -->
    </path>

    <patternset id="compile.sources">
        <include name="**/*.java"/>
    </patternset>

    <patternset id="test.sources">
        <include name="**/*Test.java"/>
    </patternset>

    <!-- ======================================================================================= -->
    <!-- TARGETs                                                                                 -->
    <!-- ======================================================================================= -->

    <!-- all =================================================================================== -->
    <target name="all" depends="jar, javadoc" description="Calls jar and javadoc targets"/>

    <!-- init ================================================================================== -->
    <target name="init">

        <!-- Check for min build requirements -->
        <condition property="ant.not.ok" value="true">
            <not>
                <or>
                    <contains string="${ant.version}" substring="1.6"/>
                    <contains string="${ant.version}" substring="1.7"/>
                </or>
            </not>
        </condition>
        <condition property="java.not.ok" value="true">
            <not>
                <or>
                    <contains string="${ant.java.version}" substring="1.5"/>
                    <contains string="${ant.java.version}" substring="1.6"/>
                </or>
            </not>
        </condition>
        <fail if="ant.not.ok" message="Must use Ant 1.6.x or 1.7.x to build Connection Manager"/>
        <fail if="java.not.ok" message="Must use JDK 1.5.x or higher to build Connection Manager"/>

        <tstamp/>
        <tstamp>
            <format property="builddate" pattern="MM/dd/yyyy"/>
        </tstamp>
        <tstamp>
            <format property="dailybuild.tstamp" pattern="yyyy-MM-dd" locale="en"/>
        </tstamp>

        <mkdir dir="${target.dir}"/>

        <!-- Setup the full version property correctly -->
        <if>
            <equals arg1="${version.extra}" arg2=""/>
            <then>
                <property name="version" value="${version.major}.${version.minor}.${version.revision}"/>
                <property name="version.filename" value="${version.major}_${version.minor}_${version.revision}"/>
            </then>
            <else>
                <property name="version" value="${version.major}.${version.minor}.${version.revision}.${version.extra}"/>
                <property name="version.filename" value="${version.major}_${version.minor}_${version.revision}_${version.extra}"/>
            </else>
        </if>

    </target>

    <!-- compile =============================================================================== -->
    <target name="compile" depends="init" description="Compiles Connection Manager app code">
        <mkdir dir="${compile.dir}"/>
        <javac
            destdir="${compile.dir}"
            includeAntRuntime="no"
            debug="on"
            source="1.5"
            target="1.5"
            >
            <src path="${src.java.dir}"/>
            <patternset refid="compile.sources"/>
            <classpath>
                <path refid="compile.dependencies"/>
            </classpath>
        </javac>
    </target>

    <!-- i18n ================================================================================== -->
    <!-- Note, this is a "private" target - no need to call it externally -->
    <target name="-i18n">
        <!-- Auto generates a default base i18n file -->
        <mkdir dir="${target.i18n.dir}"/>
        <copy file="${src.i18n.dir}/${i18n.basename}_${i18n.default.locale}.properties"
            tofile="${target.i18n.dir}/${i18n.basename}.properties"/>

    </target>

    <!-- jar =================================================================================== -->
    <target name="jar" depends="compile, -i18n" description="Produces Connection Managers jars and sets up dependencies">
        <mkdir dir="${jar.dest.dir}"/>
        <!-- Make main Connection Manager jar -->
        <jar jarfile="${jar.dest.dir}/${jar.name}" index="true" duplicate="preserve">
            <fileset dir="${compile.dir}" includes="**/*.class"
                     excludes="org/jivesoftware/multiplexer/starter/ServerStarter*.class,org/jivesoftware/multiplexer/launcher/*.class"/>
            <fileset dir="${src.i18n.dir}" includes="*.properties"/>
            <fileset dir="${target.i18n.dir}" includes="*.properties"/>
            <fileset dir="${src.dir}" includes="database/*.sql"/>
            <fileset dir="${src.dir}" includes="database/upgrade/**/*.sql"/>
            <zipgroupfileset dir="${lib.merge.dir}" includes="*.jar"/>
            <manifest>
                <attribute name="Built-By" value="Jive Software (www.igniterealtime.org)"/>
            </manifest>
        </jar>

        <!-- Make startup jar -->
        <jar jarfile="${jar.dest.dir}/${jar.starter.name}">
            <fileset dir="${compile.dir}">
                <include name="org/jivesoftware/multiplexer/starter/ServerStarter*.class"/>
                <include name="org/jivesoftware/multiplexer/launcher/*.class"/>
                <include name="org/jivesoftware/multiplexer/starter/JiveClassLoader*.class"/>
            </fileset>
            <fileset dir="${lib.build.installer.dir}/images" includes="**/*.gif"/>
            <fileset dir="${lib.build.installer.dir}/images" includes="**/*.png"/>
            <manifest>
                <attribute name="Main-Class" value="org.jivesoftware.multiplexer.starter.ServerStarter"/>
                <attribute name="Built-By" value="Jive Software (www.igniterealtime.org)"/>
            </manifest>
        </jar>
        <!-- Copy application dependent files -->
        <copy todir="${jar.dest.dir}">
            <fileset dir="${lib.dist.dir}" includes="*.*"/>
        </copy>

        <!-- Setup environment -->
        <antcall target="-prepare"/>
    </target>

    <!-- run =================================================================================== -->
    <target name="run"  description="Starts Connection Manager inline to the build process.">
        <echo>Ensure that you have run ant jar!</echo>
        <condition property="run.debug" value="-Xdebug -Xint -server -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000">
            <isset property="debug"/>
        </condition>
        <java jar="${target.dir}/lib/startup.jar" fork="true" dir="${target.dir}/bin">
            <jvmarg line="${run.debug}"/>
        </java>
    </target>

    <!-- deployjar ============================================================================= -->
    <target name="deployjar" depends="jar" description="Pushes JARs to specified web location.">
        <copy todir="${deploy.jar.dir}" overwrite="${overwrite}">
            <fileset dir="${jar.dest.dir}" includes="*.jar"/>
        </copy>
    </target>

    <!-- javadoc =============================================================================== -->
    <target name="javadoc" depends="compile" description="Produces Connection Manager Javadocs">
        <mkdir dir="${javadoc.dest.dir}"/>
        <antcall target="-javadoc-impl"/>

    </target>
    <target name="-javadoc-impl" unless="no.javadoc">

        <!-- Run javadoc over all source code -->
        <javadoc
            packagenames="org.jivesoftware.*, org.xmpp.*"
            destdir="${javadoc.dest.dir}"
            windowtitle="Connection Manager ${version} Javadoc"
            overview="${src.java.dir}/overview.html"
            failonerror="yes"
            >
            <sourcepath>
                <path location="${src.java.dir}"/>
            </sourcepath>
            <doctitle><![CDATA[<font face="arial,helvetica,sans-serif">Connection Manager ${version} Javadoc</font>]]></doctitle>
            <header><![CDATA[<b>Connection Manager ${version} Javadoc</b>]]></header>
            <bottom><![CDATA[<i>Copyright &copy; 2003-2006 Jive Software.</i>]]></bottom>
            <classpath>
                <path refid="javadoc.dependencies"/>
            </classpath>
            <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistLoc="${javadoc.src.dir}/jdk15"/>
        </javadoc>
    </target>

    <!--
    <target name="with-clover">
        <clover-setup initString="${target.dir}/test/cmanager-coverage.db" />
    </target>

    <target name="clover-html" depends="with-clover">
        <mkdir dir="${test.results.dest.dir}/clover" />
        <clover-report>
            <current outfile="${test.results.dest.dir}/clover">
                <format type="html"/>
            </current>
        </clover-report>
    </target>
    -->

    <!-- test ================================================================================== -->
    <target name="test" depends="jar" description="Compiles and runs test cases">
        <!-- Compile all test code -->
        <mkdir dir="${test.classes.dest.dir}"/>
        <javac
            destdir="${test.classes.dest.dir}"
            includeAntRuntime="no"
            debug="on"
            source="1.5"
            target="1.5"
            >
            <src path="${src.test.java.dir}"/>
            <patternset refid="test.sources"/>
            <classpath>
                <path refid="test.dependencies"/>
                <pathelement path="${compile.dir}"/>
            </classpath>
        </javac>

        <!-- Run jUnit -->
        <mkdir dir="${test.results.dest.dir}"/>
        <junit printsummary="yes" haltonfailure="yes" fork="yes" dir="${test.dest.dir}">

            <!-- We must add our own classes to the classpath for testing -->
            <classpath>
                <path refid="test.dependencies"/>
                <pathelement path="${test.classes.dest.dir}"/>
            </classpath>

            <formatter type="plain"/>

            <batchtest todir="${test.results.dest.dir}">
                <fileset dir="${src.test.java.dir}">
                    <patternset refid="test.sources"/>
                </fileset>
            </batchtest>
        </junit>
    </target>

    <target name="-prepare">

        <property name="prepare.out.dir" value="${target.dir}"/>

        <!-- Copy lib dir -->
        <copy todir="${prepare.out.dir}/lib">
            <fileset dir="${jar.dest.dir}" includes="*.*"></fileset>
        </copy>

        <!-- Copy conf dir -->
        <copy todir="${prepare.out.dir}">
            <fileset dir="${src.dir}" includes="conf/**/*.*"></fileset>
        </copy>

        <!-- Copy security resources -->
        <copy todir="${prepare.out.dir}/resources">
            <fileset dir="${src.dir}">
                <include name="security/*"/>
                <include name="security/*.*"/>
            </fileset>
        </copy>

        <!-- Copy bin dir -->
        <copy todir="${prepare.out.dir}">
            <fileset dir="${src.dir}" includes="bin/**/*" />
        </copy>
        <fixcrlf srcdir="${prepare.out.dir}/bin" eol="lf" eof="remove" includes="*.sh,extra/*"/>

        <!-- Create a logs dir in the binary release -->
        <mkdir dir="${prepare.out.dir}/logs"/>

    </target>

    <!-- release =============================================================================== -->
    <target name="release" depends="jar,javadoc" description="Creates a distribution">
        <mkdir dir="${release.dest.dir}"/>

        <!-- Create a new prop for the final release dirs then create the dirs -->

        <!-- ie: connection_manager -->
        <property name="release.name" value="${dist.prefix}"/>
        <!-- ie: connection_manager_src -->
        <property name="release.name.src" value="${dist.prefix}_src"/>
        <!-- ie: connection_manager_2_1_2 -->
        <property name="release.fullname" value="${dist.prefix}_${version.filename}"/>
        <!-- ie: connection_manager_src_2_1_2 -->
        <property name="release.fullname.src" value="${dist.prefix}_src_${version.filename}"/>

        <property name="release.out.dir" value="${release.dest.dir}/${release.name}"/>
        <property name="release.src.out.dir" value="${release.dest.dir}/${release.name.src}"/>

        <mkdir dir="${release.out.dir}"/>
        <mkdir dir="${release.src.out.dir}"/>

        <!-- Copy all prepare dirs to the binary dist -->
        <ant antfile="${basedir}/build/build.xml" target="-prepare">
            <property name="prepare.out.dir" value="${release.out.dir}"/>
        </ant>

        <!-- Remove the development scripts -->
        <delete file="${release.out.dir}/bin/cmanager-dev.bat"/>
        <delete file="${release.out.dir}/bin/cmanager-dev.sh"/>

        <!-- Pack200 processing on JAR files in lib dir -->

        <for param="jar">
            <path>
                <fileset dir="${release.out.dir}/lib" includes="*.jar" excludes="startup.jar,jdic.jar,mail.jar,activation.jar,bouncycastle.jar" />
            </path>
            <sequential>
                <delete file="@{jar}.pack" />
                <pack200 src="@{jar}"
                    destfile="@{jar}.pack"
                    gzipoutput="false"
                />
                <delete file="@{jar}" />
            </sequential>
        </for>

        <!-- Copy dist docs, use filtering  -->
        <copy todir="${release.out.dir}">
            <fileset dir="${docs.dir}/dist" includes="*.*" excludes="LICENSE.html"/>
            <filterset>
                <filter token="builddate" value="${builddate}"/>
                <filter token="version" value="${version}"/>
            </filterset>
        </copy>
        <copy todir="${release.src.out.dir}">
            <fileset dir="${docs.dir}/dist" includes="*.*" excludes="LICENSE.html"/>
            <filterset>
                <filter token="builddate" value="${builddate}"/>
                <filter token="version" value="${version}"/>
            </filterset>
        </copy>
        <!-- Copy the license -->
        <copy todir="${release.out.dir}" file="${license.file.path}/LICENSE.html"/>
        <copy todir="${release.src.out.dir}" file="${license.file.path}/LICENSE.html"/>
        <mkdir dir="${release.out.dir}/logs" />
        <touch file="${release.out.dir}/logs/stderr.out" />

        <!-- Copy docs -->
        <copy todir="${release.out.dir}/documentation">
            <fileset dir="${docs.dir}/docs"/>
            <filterset>
                <filter token="version" value="${version}"/>
            </filterset>
        </copy>
        <copy todir="${release.src.out.dir}/documentation">
            <fileset dir="${docs.dir}" includes="**/*.*"/>
            <filterset>
                <filter token="version" value="${version}"/>
            </filterset>
        </copy>

        <!-- Copy Javadocs -->
        <copy todir="${release.out.dir}/documentation/javadoc">
            <fileset dir="${javadoc.dest.dir}"/>
        </copy>
        <copy todir="${release.src.out.dir}/documentation/docs/javadoc">
            <fileset dir="${javadoc.dest.dir}"/>
        </copy>

        <!-- Copy source -->
        <copy todir="${release.src.out.dir}/src">
            <fileset dir="${src.dir}"/>
        </copy>

        <!-- Copy the i18n files to the resources dir. This way they won't be in the jar only -->
        <copy todir="${release.out.dir}/resources/i18n">
            <fileset dir="${target.i18n.dir}" includes="*.properties"/>
            <fileset dir="${src.i18n.dir}" includes="*.properties"/>
        </copy>
        <copy todir="${release.src.out.dir}/resources/i18n">
            <fileset dir="${target.i18n.dir}" includes="*.properties"/>
            <fileset dir="${src.i18n.dir}" includes="*.properties"/>
        </copy>

        <!-- Copy build -->
        <copy todir="${release.src.out.dir}/build">
            <fileset dir="${basedir}/build"/>
        </copy>

        <!-- Package the release -->
        <antcall target="release-package"/>

    </target>

    <!-- quickrelease ========================================================================== -->
    <target name="quickrelease" description="Makes an unpackaged release without Javadocs">
        <antcall target="release">
            <param name="no.javadoc" value="true"/>
            <param name="no.package" value="true"/>
        </antcall>
    </target>

    <!-- release-package ======================================================================= -->
    <target name="release-package" unless="no.package" description="Packages a release">

        <property name="package.dest.dir" value="${release.dest.dir}"/>

        <!-- ZIP -->
        <zip zipfile="${package.dest.dir}/${release.fullname}.zip"
            basedir="${release.out.dir}/.."
            includes="${release.fullname}/**/*, ${release.name}/**/*"
            />
        <zip zipfile="${package.dest.dir}/${release.fullname.src}.zip"
            basedir="${release.src.out.dir}/.."
            includes="${release.fullname.src}/**/*, ${release.name.src}/**/*"
            />
        <!-- TAR.GZ -->
        <tar tarfile="${package.dest.dir}/${release.fullname}.tar.gz"
            basedir="${release.out.dir}/.."
            includes="${release.fullname}/**/*, ${release.name}/**/*"
            compression="gzip"
            longfile="gnu"
            />
        <tar tarfile="${package.dest.dir}/${release.fullname.src}.tar.gz"
            basedir="${release.src.out.dir}/.."
            includes="${release.fullname.src}/**/*, ${release.name.src}/**/*"
            compression="gzip"
            longfile="gnu"
            />

    </target>

    <!-- dailybuild ============================================================================ -->
    <target name="dailybuild" depends="init" description="Creates a daily build release">
        <property name="release.out.name" value="${dist.prefix}_${dailybuild.tstamp}"/>
        <property name="release.fullname" value="${release.out.name}"/>
        <property name="release.src.out.name" value="${dist.prefix}_src_${dailybuild.tstamp}"/>
        <property name="release.fullname.src" value="${release.src.out.name}"/>
        <property name="release.out.dir" value="${release.dest.dir}/dailybuild/${release.out.name}"/>
        <property name="release.src.out.dir" value="${release.dest.dir}/dailybuild/${release.src.out.name}"/>
        <antcall target="release">
            <param name="release.out.name" value="${release.out.name}"/>
            <param name="release.src.out.name" value="${release.src.out.name}"/>
            <param name="release.out.dir" value="${release.out.dir}"/>
            <param name="release.src.out.dir" value="${release.src.out.dir}"/>
            <param name="package.dest.dir" value="${release.dest.dir}/dailybuild"/>
        </antcall>
    </target>

    <!-- installer ============================================================================= -->
    <target name="installer" depends="release" description="Creates an Install4j installer">

        <condition property="install4j.not.ok" value="true">
            <not>
                <available file="${installer.install4j.home}/bin/install4j.jar"/>
            </not>
        </condition>
        <fail if="install4j.not.ok" message="Path to Install4j not set, see build.properties.template file."/>

        <taskdef name="install4j"
            classname="com.install4j.Install4JTask"
            classpath="${installer.install4j.home}/bin/install4j.jar"/>

        <mkdir dir="${installer.dest.dir}"/>

        <install4j projectfile="${installer.install4j.srcfile}" destination="${installer.dest.dir}">
            <variable name="VERSION_MAJOR" value="${version.major}"/>
            <variable name="VERSION_MINOR" value="${version.minor}"/>
            <variable name="VERSION_REVISION" value="${version.revision}"/>
            <variable name="APP_NAME" value="${installer.app_name}"/>
            <variable name="APP_SHORT_NAME" value="${installer.app_short_name}"/>
            <variable name="PRODUCT_NAME" value="${installer.product_name}"/>
            <variable name="PUBLISHER" value="${installer.publisher}"/>
            <variable name="PUBLISHER_URL" value="${installer.publisher_url}"/>
            <variable name="FILE_PREFIX" value="${installer.app_short_name}"/>
            <variable name="RELEASE_ROOT_PATH" value="${installer.release_root_path}"/>
            <variable name="APPLICATION_ID" value="${installer.application_id}"/>
            <variable name="UNIX_INSTALL_DIR" value="${installer.unix_install_dir}"/>
            <variable name="WINDOWS_INSTALL_DIR" value="${installer.windows_install_dir}"/>
        </install4j>

    </target>

    <!-- anttasks ============================================================================== -->
    <target name="anttasks" depends="init">

        <mkdir dir="${anttools.target.dir}"/>
        <mkdir dir="${anttools.target.dir}/classes"/>

        <javac
            destdir="${anttools.target.dir}/classes"
            includeAntRuntime="no"
            debug="on"
            source="1.4"
            >
            <src path="${anttools.src.dir}"/>
            <patternset refid="compile.sources"/>
            <classpath>
                <path refid="compile.dependencies"/>
            </classpath>
        </javac>

        <jar jarfile="${anttools.target.dir}/ant-subdirtask.jar">
            <fileset dir="${anttools.target.dir}/classes" includes="**/*.class"/>
        </jar>
    </target>

    <!-- clean ================================================================================= -->
    <target name="clean" description="Cleans up all build-generated output">
        <delete dir="${target.dir}"/>
    </target>

    <!-- clean-test ============================================================================ -->
    <target name="clean-test" description="Cleans all compiled test classes">
        <delete dir="${test.classes.dest.dir}"/>
    </target>

</project>
