<project name="Clover_Tutorial" default="test" basedir=".">

    <property name="build.classes" location="build/classes"/>
    <property name="build.testclasses" location="build/testclasses"/>
    <property name="build.testresults" location="build/testresults"/>

    <property name="junit.jar" location="lib/junit-4.13.2.jar"/>
    <property name="hamcrest.jar" location="lib/hamcrest-2.2.jar"/>

    <path id="build.classpath">
        <pathelement location="${build.classes}"/>
    </path>

    <path id="testbuild.classpath">
        <path refid="build.classpath"/>
        <pathelement location="${junit.jar}"/>
        <pathelement location="${hamcrest.jar}"/>
        <pathelement location="${build.testclasses}"/>
    </path>

    <target name="compile">
        <mkdir dir="${build.classes}"/>
        <javac srcdir="src/main/java" destdir="${build.classes}" classpathref="build.classpath" includeantruntime="false" source="1.8" target="1.8"/>

        <mkdir dir="${build.testclasses}"/>
        <javac srcdir="src/test/java" destdir="${build.testclasses}" classpathref="testbuild.classpath" includeantruntime="false" source="1.8" target="1.8"/>
    </target>

    <target name="test" depends="compile">
        <mkdir dir="${build.testresults}"/>
        <junit fork="yes" printsummary="true" showoutput="true">
            <classpath refid="testbuild.classpath"/>
            <formatter type="xml"/>
            <batchtest fork="yes" todir="${build.testresults}">
                <fileset dir="${build.testclasses}" includes="**/*Test.*"/>
            </batchtest>
        </junit>
    </target>

    <target name="clean">
        <delete dir="build"/>
    </target>

</project>
