JAL-1270 test suits import order refactor
[jalview.git] / build.xml
index e77dfb2..dbf1df3 100755 (executable)
--- a/build.xml
+++ b/build.xml
     <property name="jsonSimple" value="json_simple-1.1.jar" />
     <property name="javaJson" value="java-json.jar" />
     <property name="jalviewLiteJar" value="jalviewApplet.jar" />
+       <property name="reportDir" value="test-reports" />
+       <property name="testDir" value="test" />
+       <property name="testOutputDir" value="tests" />
     <!-- switch to indicate if we should obfuscate jalviewLite -->
     <!-- <property name="donotobfuscate" value="true"/> -->
     <!-- switch to exclude associations from generated jnlp files -->
       <exclude name="com/stevesoft/**" />
     </javac>
   </target>
+  
+  
+  <target name="testclean" depends="init">
+    <delete dir="${testOutputDir}" includes="*,**/*"/>
+  </target>
+  
+  <target name="prepareTests" depends="init">
+       <mkdir dir="${testOutputDir}" />
+       <copy todir="${testOutputDir}">
+               <fileset dir=".">
+                       <include name="${docDir}/**/*.*" />
+                       <include name="${helpDir}/**/*.*" />
+                       <include name="${libDir}/*.jar" />
+               </fileset>
+               <fileset dir="${resourceDir}">
+                       <include name="**/*.*" />
+               </fileset>
+       </copy>
+  </target>  
+  
+  <target name="buildTests" depends="prepareTests">
+       <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${testOutputDir}"
+               debug="${javac.debug}" classpathref="build.classpath" includeantruntime="false" >
+               <exclude name="jalview/*applet*" />
+               <exclude name="jalview/appletgui/**" />
+       </javac>
+       <javac source="1.5" target="1.5" srcdir="${testDir}" destdir="${testOutputDir}"
+               debug="${javac.debug}" classpathref="build.classpath" includeantruntime="false" >
+       </javac>
+  </target>
+  
+  <taskdef name="testng" classname="org.testng.TestNGAntTask" >            
+       <classpath location="utils/testnglibs/testng.jar" />
+  </taskdef>
+  
+  <target name="testng" depends="buildTests">
+       <testng classpathref="build.classpath" outputDir="${reportDir}"
+               haltOnFailure="false">
+               <classpath location="${testOutputDir}" />
+               <xmlfileset dir="utils" includes="jalview_testng.xml" />
+       </testng>
+  </target>
+  
   <target name="buildindices" depends="init, prepare" unless="help.uptodate">
     <java classname="com.sun.java.help.search.Indexer" classpathref="build.classpath" fork="true" dir="${outputDir}/${helpDir}">
       <arg line="html" />
   <path id="obfuscateDeps.path">
     <pathelement location="${applet.jre.tools}" />
     <pathelement location="appletlib/${jmolJar}" />
+    <pathelement location="appletlib/${jsonSimple}" />
+    <pathelement location="appletlib/${javaJson}" />
   </path>
   <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
 
     </fileset>
   </copy>
   <jar update="true" index="true" jarfile="${packageDir}/examples/${jalviewLiteJar}"/>
+  <jar update="true" index="true" jarfile="${packageDir}/examples/${javaJson}"/>
+  <jar update="true" index="true" jarfile="${packageDir}/examples/${jsonSimple}"/>
   <jar update="true" index="true" jarfile="${packageDir}/examples/${jmolJar}">
-  <jar update="true" index="true" jarfile="${packageDir}/examples/${javaJson}">
-  <jar update="true" index="true" jarfile="${packageDir}/examples/${jsonSimple}">
     <manifest>
       <attribute name="Application-Name" value="Jmol (bundled with JalviewLite)"/>
       <!--          <attribute name="Permissions" value="sandbox" /> -->