JAL-1888 compile tests to separate directory and pass directly as fileset to testNG...
authorJim Procter <jprocter@issues.jalview.org>
Fri, 18 Sep 2015 12:47:04 +0000 (13:47 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Fri, 18 Sep 2015 12:47:04 +0000 (13:47 +0100)
build.xml

index 29e151b..a517ec2 100755 (executable)
--- a/build.xml
+++ b/build.xml
         <include name="${jmolJar}" />
         <include name="${varnaJar}" />
       </fileset>
-
+    </path>
+    <path id="test.classpath">
+      <pathelement path="${outputDir}" />
+      <path refid="build.classpath" />
     </path>
     <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz" />
     <!-- The Location of the java 1.1.8 jdk -->
   <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="${javac.source}" target="${javac.target}" srcdir="${sourceDir}" destdir="${testOutputDir}"
-               debug="${javac.debug}" classpathref="build.classpath" includeantruntime="false" >               
-       </javac>
-       <javac source="${javac.source}" target="${javac.target}" srcdir="${testDir}" destdir="${testOutputDir}"
-               debug="${javac.debug}" classpathref="build.classpath" includeantruntime="false" >
-       </javac>
+
+  <target name="prepareTests" depends="init,clean">
+    <mkdir dir="${testOutputDir}" />
   </target>
-  
-  <taskdef name="testng" classname="org.testng.TestNGAntTask" >            
-       <classpath location="utils/testnglibs/testng.jar" />
-  </taskdef>
-  
+
+  <target name="buildTests" depends="build,buildindices,prepareTests">
+    <javac source="${javac.source}" target="${javac.target}" srcdir="${testDir}" destdir="${testOutputDir}" debug="${javac.debug}" classpathref="test.classpath" includeantruntime="false">
+    </javac>
+  </target>
+
+  <taskdef resource="testngtasks" classpath="utils/testnglibs/testng.jar" />
+
   <target name="testng" depends="buildTests">
-       <testng classpathref="build.classpath" outputDir="${reportDir}"
-               haltOnFailure="false">
-               <classpath location="${testOutputDir}" />
-               <xmlfileset dir="utils" includes="jalview_testng.xml" />
-       </testng>
+    <testng outputDir="${reportDir}" haltOnFailure="false" groups="${testng-groups}" mode="testng">
+      <classpath>
+        <pathelement location="${testOutputDir}" />
+        <path refid="test.classpath" />
+      </classpath>
+      <classfileset dir="${testOutputDir}" includes="**/*.class" />
+    </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" />