<?xml version="1.0"?>

<project name="Game Input API" basedir="." default="all">
    <target name="init">
		<property name="utils" location="../lib/jutils.jar"/>    
        <mkdir dir="apidocs"/> 
        <mkdir dir="classes"/> 
        <mkdir dir="bin"/> 
    	<mkdir dir="build"/>
    </target>

    <target name="compile" depends="init">
		<javac srcdir="src/java" destdir="classes" debug="true" deprecation="true" source="1.4" target="1.4">
			<include name="net/**"/>
			<exclude name="**/Version.java"/>
			<!-- To add something to the classpath: -->
			<classpath>
				<pathelement location="${utils}"/>
			</classpath>
		</javac>
    	<buildnumber/>
		<copy file="src/java/net/java/games/input/Version.java" 
    		 todir="build/src/java/net/java/games/input/" overwrite="true">
			<filterset>
				<filter token="BUILD_NUMBER" value="${build.number}"/>
			</filterset>
		</copy>
		<javac srcdir="build/src/java" destdir="classes" debug="true" deprecation="true" source="1.4" target="1.4">
			<include name="net/**" />
		</javac>
    </target>

    <target name="jar" depends="init,compile">
        <jar jarfile="bin/jinput-core.jar" compress="true" basedir="classes">
			<include name="net/java/games/input/*class"/>
        </jar>
        <jar jarfile="bin/jinput-test.jar" compress="true" basedir="classes">
			<include name="net/java/games/input/test/*class"/>
        </jar>
    </target>

    <target name="javadoc" depends="init" description="Javadoc for my API.">
        <javadoc packagenames="net.java.games.input.*" 
                 destdir="apidocs" 
                 additionalparam="-source 1.4"
	        	 excludepackagenames="net.java.games.input.example.*,net.java.games.input.test.*">
            <sourcepath>
                <pathelement location="src/java"/>
            </sourcepath>
             <classpath>
                <pathelement location="${utils}"/>
            </classpath>
        </javadoc>
    </target>

    <target name="clean" depends="init" description="Clean all build products.">
		<delete dir="classes"/>
		<delete dir="bin"/>
		<delete dir="apidocs"/>
		<delete dir="build"/>
    </target>
    
    <target name="all" depends="init,jar" description="Build everything.">
        <echo message="JInput has been built and jinput.jar is located in the bin directory."/>
	</target>    
</project>
