Author: batosai
Date: 2008-09-04 17:42:20 +0000 (Thu, 04 Sep 2008)
New Revision: 22428

Modified:
   trunk/apps/WoT/build.xml
Log:
Added junit support.

Modified: trunk/apps/WoT/build.xml
===================================================================
--- trunk/apps/WoT/build.xml    2008-09-04 17:42:03 UTC (rev 22427)
+++ trunk/apps/WoT/build.xml    2008-09-04 17:42:20 UTC (rev 22428)
@@ -4,9 +4,11 @@
 <project name="WoT" default="dist" basedir=".">
        <property name="freenet-cvs-snapshot.location" 
location="/home/julien/workspace/Freenet 0.7/lib/freenet-cvs-snapshot.jar"/>
        <property name="freenet-ext.location" 
location="/home/julien/workspace/Freenet 0.7/lib/freenet-ext.jar"/>
+       <property name="junit.location" value="/usr/share/java/junit.jar"/>
        <property name="db4o.location" 
location="/home/julien/db4o-7.2/lib/db4o-7.2.39.10644-java5.jar"/>
        <property name="source-version" value="1.5"/>
        <property name="build" location="build/"/>
+       <property name="build-test" location="build-test"/>
        <property name="dist" location="dist/"/>

        <target name="mkdir">
@@ -14,7 +16,11 @@
                <mkdir dir="${dist}"/>
        </target>

-       <target name="compile" depends="mkdir" >
+       <target name="env" depends="mkdir"   description="Learn about the 
environment">
+               <available file="${junit.location}" property="junit.present"/>
+       </target>
+       
+       <target name="compile" depends="env" >
                <javac srcdir="src/" destdir="${build}" debug="on" 
optimize="on">
                        <classpath>
                                <pathelement 
location="${freenet-ext.location}"/>
@@ -22,11 +28,57 @@
                                <pathelement location="${db4o.location}"/>
                        </classpath>
                        <include name="**/*.java"/>
+                       <exclude name="**/*Test.java"/>
                </javac>
        </target>
+       
+       <!-- ================================================== -->
+       
+       <target name="unit-build" depends="compile" if="junit.present" 
unless="skip_tests">
+               <delete dir="${build-test}"/>
+               <mkdir dir="${build-test}"/>

+               <javac srcdir="src/" destdir="${build-test}" debug="on" 
optimize="on" source="1.5">
+                       <classpath>
+                               <pathelement path="${build}"/>
+                               <pathelement 
location="${freenet-ext.location}"/>
+                               <pathelement 
location="${freenet-cvs-snapshot.location}"/>
+                               <pathelement location="${db4o.location}"/>
+                               <pathelement location="${junit.location}"/>
+                       </classpath>
+                       <compilerarg value="-Xlint"/>
+                       <include name="**/*Test.java"/>
+                       <exclude name="*.java"/>
+               </javac>
+       </target>
+       
+
+       <target name="unit" depends="unit-build" if="junit.present" 
unless="skip_tests">
+               <junit printsummary="yes" fork="yes" haltonfailure="yes">
+                       <classpath>
+                               <pathelement path="${build}"/>
+                               <pathelement path="${build-test}"/>
+                               <pathelement location="${junit.location}"/>
+                               <pathelement 
location="${freenet-ext.location}"/>
+                               <pathelement 
location="${freenet-cvs-snapshot.location}"/>
+                               <pathelement location="${db4o.location}"/>
+                       </classpath>
+
+                       <formatter type="plain" usefile="false"/>
+
+                       <batchtest fork="yes">
+                               <fileset dir="${build-test}">
+                                       <include name="**/*Test.class"/>
+                               </fileset>
+                       </batchtest>
+                       <sysproperty key="benchmark" value="${benchmark}" />
+                       <sysproperty key="extensiveTesting" 
value="${extensiveTesting}" />
+               </junit>
+       </target>
+       
        <!-- ================================================== -->
-       <target name="dist" depends="clean,compile"
+       
+       <target name="dist" depends="clean,compile,unit"
                description="generate the distribution" >
                <jar jarfile="${dist}/wot.jar" duplicate="fail">
                        <manifest>


Reply via email to