<!-- (jEdit options) :folding=explicit:collapseFolds=1: -->
<project name="moteking" default="build" basedir=".">
<description>Mote navigation tool by VBC</description>

<!-- global properties that we always want defined {{{ -->
<property name="src"        location="src"/>
<property name="resource"   location="resource"/>
<property name="build"      location="build"/>
<property name="dist"       location="dist"/>
<!-- Version control: creates timestamp, updates ${buildnum}, loads ${version} -->
<target name="init">
    <tstamp>
        <format property="DSTAMP_SIX" pattern="yyMMdd"/>
    </tstamp>
    <propertyfile file="${resource}/${ant.project.name}/buildnum.props">
        <entry key="buildnum" value="${DSTAMP}.${TSTAMP}"/>
    </propertyfile>
    <property file="${resource}/${ant.project.name}/buildnum.props"/>
    <property file="${resource}/${ant.project.name}/version.props"/>
</target>
<!-- }}} -->

<!-- build, compile {{{ -->
<!-- Bundles up all needed class and resource files into a JAR -->
<target name="build" description="Build class files" depends="init,compile">
    <echo message="Version ${version}"/>
    <echo message="Build # ${buildnum}"/>
    <jar jarfile="${ant.project.name}.jar" index="false">
        <fileset dir="${build}"/>
        <fileset dir="${resource}"/>
        <!-- <fileset dir="../../driftwood/build/"/>
        <fileset dir="../../driftwood/resource/"/> -->
    </jar>
</target>

<!-- Compiles all .java files for this package -->
<target name="compile" depends="init">
    <ant antfile="../../driftwood/build.xml" inheritAll="false" target="compile">
        <!-- inherited properties go here -->
    </ant>
    <ant antfile="../../king/build.xml" inheritAll="false" target="compile">
        <!-- inherited properties go here -->
    </ant>
    <mkdir dir="${build}"/>
    <javac srcdir="${src}"
           destdir="${build}"
           includes="**/*.java"
           excludes="**/old/"
           debug="on" debuglevel="lines,source">
         <classpath>
            <!-- <pathelement location="../../driftwood/build"/> -->
            <pathelement location="../../king/build"/>
            <pathelement location="bluecove-2.0.2.jar"/>
            <pathelement location="commons-logging-1.1.1.jar"/>
         </classpath>
    </javac>
</target>
<!-- }}} -->

<!-- dist, dist-src, dist-exe {{{ -->
<!-- Makes .zip and .tgz files from the ${dist} directory -->
<target name="dist" description="Generate the distributions" depends="init,clean,build,dist-src,dist-exe">
    <zip destfile="${dist}/${ant.project.name}-${version}-src.zip">
         <zipfileset dir="${dist}" includes="${ant.project.name}-${version}-src/"/>
         <zipfileset dir="../driftwood/dist/" includes="driftwood-*-src/"/>
    </zip>
    <zip basedir="${dist}"
         destfile="${dist}/${ant.project.name}-${version}.zip"
         includes="${ant.project.name}-${version}/"/>
</target>

<!-- Makes the source code distribution -->
<target name="dist-src" depends="init">
    <ant antfile="../driftwood/build.xml" inheritAll="false" target="dist-src">
        <!-- inherited properties go here -->
    </ant>
    <mkdir dir="${dist}/${ant.project.name}-${version}-src"/>
    <copy todir="${dist}/${ant.project.name}-${version}-src" preservelastmodified="true">
        <fileset dir="${basedir}">
            <exclude name="build/"/>
            <exclude name="dist/"/>
            <exclude name="**/old/"/>
        </fileset>
    </copy>
</target>

<!-- Makes the end-user distribution -->
<target name="dist-exe" depends="init,build">
    <mkdir dir="${dist}/${ant.project.name}-${version}"/>
    <copy todir="${dist}/${ant.project.name}-${version}" preservelastmodified="true">
        <fileset dir="${basedir}">
            <include name="${ant.project.name}.jar"/>
            <include name="README*"/>
            <include name="LICENSE*"/>
            <include name="doc/"/>
            <exclude name="doc/work/"/>
        </fileset>
    </copy>
</target>
<!-- }}} -->

<!-- clean, backup {{{ -->
<!-- Removes products of compilation -->
<target name="clean" description="Clean up build/ and dist/">
    <delete dir="${dist}"/>
    <delete dir="${build}"/>
    <delete file="${ant.project.name}.jar"/>
</target>
<!-- }}} -->

<!-- deploy-local {{{ -->
<!-- Deploys the executable on the local system - applies to IWD's machine only -->
<target name="deploy-local"  description="Build class files and copy to plugins/" depends="build">
    <copy file="${ant.project.name}.jar" todir="../../king/plugins/" overwrite="true" failonerror="true"/>
</target>
<!-- }}} -->
</project>
