<property name="build" location="bin" />
<property name="main" value="de.j32.pimstuff.Main" />
<property name="lib" value="libs" />
-
+ <property name="test" value="tests" />
+
<target name="makedirs">
<mkdir dir="${build}" />
</target>
- <path id="classpath.lib">
+ <path id="classpath">
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</path>
-
+
+ <fileset id="tests" dir="${test}">
+ <include name="**/*.java" />
+ </fileset>
+
<target name="build" depends="makedirs" description="Compile project to ${build} directory">
- <javac srcdir="${src}" destdir="${build}" />
+ <javac srcdir="${src}" destdir="${build}" classpathref="classpath" />
</target>
<target name="clean" description="Clean up ${build} directory">
</target>
<target name="run" depends="build" description="Start main class">
- <java fork="true" classpath="${build}" classpathref="classpath.lib" classname="${main}" />
+ <java fork="true" classpath="${build}" classpathref="classpath" classname="${main}" />
+ </target>
+
+ <target name="build-tests" depends="build" description="Compile tests">
+ <javac srcdir="${test}" destdir="${build}" classpath="${build}" classpathref="classpath" />
+ </target>
+
+ <target name="test" depends="build-tests" description="Run JUnit tests">
+ <junit fork="true" printsummary="withOutAndErr" haltonerror="true">
+ <classpath>
+ <path refid="classpath" />
+ <pathelement path="${build}" />
+ <pathelement path="${test}" />
+ </classpath>
+ <batchtest>
+ <fileset refid="tests" />
+ </batchtest>
+ </junit>
</target>
</project>