<?xml version="1.0" ?>
<project name="jaramiko" default="jar" basedir=".">
    <!-- internal folder locations -->   
    <property name="src-folder" location="java" />
    <property name="build-folder" location="classes" />
    <property name="docs-folder" location="docs" />
    <property name="test-folder" location="test" />
    <property name="test-build-folder" location="test-classes" />
    <property name="junit-folder" location="junit3.8.1" />   

    <property name="dep-jars" value="" />

    <property name="jaramiko-jar" value="jaramiko.jar" />
    <property name="manifest-file" value="jaramiko.manifest" />

    <!-- junit (unit tests) -->
    <property name="junit-jar" location="${junit-folder}/junit.jar" />
    <property name="test-dep-jars" value="${dep-jars}:${junit-jar}:${jaramiko-jar}" />

    <tstamp>
        <format property="timestamp" pattern="yyyyMMdd-HHmmss" />
        <format property="today" pattern="d MMM yyyy HH:mm" />
    </tstamp>

    <target name="init">
        <mkdir dir="${build-folder}" />
        <mkdir dir="${test-build-folder}" />
    </target>

    <target name="compile" depends="init">
        <depend srcdir="${src-folder}" destdir="${build-folder}" />
        <javac source="1.3" target="1.1" debug="yes" srcdir="${src-folder}" destdir="${build-folder}" classpath="${dep-jars}" />
    </target>

    <target name="compile-tests" depends="jar">
        <javac debug="yes" srcdir="${test-folder}" destdir="${test-build-folder}" classpath="${test-dep-jars}" />
    </target>
  
    <target name="jar" depends="compile" description="create jaramiko jar">
        <manifest file="${manifest-file}">
            <attribute name="Sealed" value="false" />
            <attribute name="Build-Date" value="${TODAY}" />
            <attribute name="Build-Time" value="${TSTAMP}" />
        </manifest>
        <jar jarfile="${jaramiko-jar}" basedir="${build-folder}" manifest="${manifest-file}" />
    </target>

    <target name="test" depends="compile-tests" description="run unit tests">
        <java classname="junit.textui.TestRunner" classpath="${test-dep-jars}:${test-build-folder}">
            <arg value="net.lag.jaramiko.AllTests" />
        </java>
    </target>
    
    <target name="docs" depends="init">
        <javadoc sourcepath="${src-folder}" destdir="${docs-folder}" packagenames="net.lag.jaramiko.*" classpath="${dep-jars}" />
    </target>

    <target name="clean" description="clean built targets">
        <delete dir="${build-folder}" failonerror="false" />
        <delete dir="${test-build-folder}" failonerror="false" />
        <delete file="${jaramiko-jar}" failonerror="false" />
        <delete file="${manifest-file}" failonerror="false" />
    </target>

</project>
