<project name="rabbit" default="dist.bin" basedir=".">
    <description>
        Ant build file for RabbIT/4
    </description>

    <property name="major_version" value="4"/>
    <property name="minor_version" value="4"/>

    <!-- paths -->
    <property name="src" location="src"/>
    <property name="build" location="classes"/>
    <property name="dist" location="dist/${ant.project.name}${major_version}.${minor_version}"/>

    <!-- whether to compile with debug symbols -->
    <property name="debug_symbols" value="true"/>

    <!-- ________________________ DO NOT CHANGE ANYTHING BELOW ________________________ -->

    <path id="project.classpath">
      <fileset dir="libs">
        <include name="**/*.jar"/>
      </fileset>
    </path>

    <target name="init">
        <!-- Create the build directory structure used by compile -->
        <mkdir dir="${build}"/>
    </target>

    <target name="compile" depends="init" description="compile the source">
        <!-- Compile the java code from ${src} into ${build} -->
        <javac
                srcdir="${src}"
                destdir="${build}"
                debug="${debug_symbols}"
                classpathref="project.classpath"
                deprecation="on"
                target="1.6"
                encoding="ISO-8859-1"
        />
    </target>

    <target name="dist.bin" depends="compile" description="generate the binary distribution">
        <mkdir dir="${dist}/jars"/>
        <jar jarfile="${dist}/jars/rabbit${major_version}.jar" basedir="${build}"/>

        <javadoc sourcepath="${src}" destdir="${dist}/htdocs/javadoc" classpathref="project.classpath"/>

        <copy todir="${dist}/conf">
            <fileset dir="conf"/>
        </copy>

        <copy todir="${dist}/libs">
            <fileset dir="libs"/>
        </copy>

        <copy todir="${dist}/libs">
            <fileset dir="logs"/>
        </copy>

        <copy todir="${dist}/htdocs">
            <fileset dir="htdocs"/>
        </copy>

        <copy todir="${dist}/logs">
            <fileset dir="logs"/>
        </copy>

        <copy todir="${dist}">
            <fileset file="ChangeLog"/>
            <fileset file="LICENSE"/>
            <fileset file="README"/>
        </copy>
    </target>

    <target name="clean" description="clean up build and dist">
        <delete dir="${build}"/>
        <delete dir="${dist}"/>
    </target>
</project>
