Added JUnit testing support.
This commit is contained in:
		| @@ -51,11 +51,11 @@ | |||||||
| 
 | 
 | ||||||
|     <target name="-lib-local" if="${lib.local}"> |     <target name="-lib-local" if="${lib.local}"> | ||||||
|         <copy todir="${build.dir}/lib/compile/jar"> |         <copy todir="${build.dir}/lib/compile/jar"> | ||||||
|             <fileset dir="${lib.dir}/compile"/> |             <fileset dir="${lib.dir}/compile/jar"/> | ||||||
|         </copy> |         </copy> | ||||||
| 
 | 
 | ||||||
|         <copy todir="${build.dir}/lib/runtime/jar"> |         <copy todir="${build.dir}/lib/runtime/jar"> | ||||||
|             <fileset dir="${lib.dir}/runtime"/> |             <fileset dir="${lib.dir}/runtime/jar"/> | ||||||
|         </copy> |         </copy> | ||||||
|     </target> |     </target> | ||||||
| 
 | 
 | ||||||
| @@ -79,7 +79,7 @@ | |||||||
| 
 | 
 | ||||||
|     <!--======== COMPILATION TARGETS ========--> |     <!--======== COMPILATION TARGETS ========--> | ||||||
|     <target name="-compile-groovy" depends="-init,-init-groovy,lib"> |     <target name="-compile-groovy" depends="-init,-init-groovy,lib"> | ||||||
|         <groovyc srcdir="${src.dir}" destdir="${build.dir}/classes" |         <groovyc srcdir="${src.dir}" destdir="${build.dir}/main/classes" | ||||||
|             includeAntRuntime="false"> |             includeAntRuntime="false"> | ||||||
| 
 | 
 | ||||||
|             <classpath> |             <classpath> | ||||||
| @@ -91,25 +91,85 @@ | |||||||
|     </target> |     </target> | ||||||
| 
 | 
 | ||||||
|     <target name="-compile-java" depends="-init,lib"> |     <target name="-compile-java" depends="-init,lib"> | ||||||
|         <javac srcdir="${src.dir}" destdir="${build.dir}/classes" |         <javac srcdir="${src.dir}" destdir="${build.dir}/main/classes" | ||||||
|             includeAntRuntime="false" classpathref="compile-libs"/> |             includeAntRuntime="false" classpathref="compile-libs"/> | ||||||
|     </target> |     </target> | ||||||
| 
 | 
 | ||||||
|     <target name="compile" depends="-compile-groovy"/> |     <target name="compile" depends="-compile-groovy"/> | ||||||
| 
 | 
 | ||||||
|     <!--======== BUILD TARGETS ========--> |     <!--======== JUNIT TARGETS ========--> | ||||||
|     <target name="-build-modular" depends="compile,increment-build-number"> |     <target name="-compile-tests-groovy" depends="-init,compile"> | ||||||
|         <jar destfile="${build.dir}/${name}-${version}.${build.number}.jar" |         <groovyc srcdir="${test.dir}" destdir="${build.dir}/test/classes" | ||||||
|             basedir="${build.dir}/classes"/> |             includeAntRuntime="false"> | ||||||
|  |              | ||||||
|  |             <classpath> | ||||||
|  |                 <path refid="groovy.classpath"/> | ||||||
|  |                 <path refid="compile-libs"/> | ||||||
|  |                 <path location="${build.dir}/main/classes"/> | ||||||
|  |             </classpath> | ||||||
|  |         </groovyc> | ||||||
|     </target> |     </target> | ||||||
| 
 | 
 | ||||||
|     <target name="-build-packed-libs" depends="compile,increment-build-number"> |     <target name="-compile-tests-java" depends="-init,compile"> | ||||||
|         <unjar destdir="${build.dir}/classes"> |         <javac srcdir="${test.dir}" destdir="${build.dir}/test/classes" | ||||||
|  |             includeAntRuntime="false"> | ||||||
|  |             <classpath> | ||||||
|  |                 <path refid="compile-libs"/> | ||||||
|  |                 <path location="${build.dir}/main/classes"/> | ||||||
|  |             </classpath> | ||||||
|  |         </javac> | ||||||
|  |     </target> | ||||||
|  | 
 | ||||||
|  |     <target name="compile-tests" depends="-compile-tests-groovy"/> | ||||||
|  | 
 | ||||||
|  |     <target name="run-tests" depends="compile-tests,resources-test"> | ||||||
|  |         <junit printsummary="true"> | ||||||
|  |             <classpath> | ||||||
|  |                 <path refid="groovy.classpath"/> | ||||||
|  |                 <path refid="compile-libs"/> | ||||||
|  |                 <path location="${build.dir}/main/classes"/> | ||||||
|  |                 <path location="${build.dir}/test/classes"/> | ||||||
|  |             </classpath> | ||||||
|  |             <formatter type="plain" usefile="false"/> | ||||||
|  |             <batchtest> | ||||||
|  |                 <fileset dir="${build.dir}/test/classes"> | ||||||
|  |                     <include name="**/*"/> | ||||||
|  |                 </fileset> | ||||||
|  |             </batchtest> | ||||||
|  |         </junit> | ||||||
|  |     </target> | ||||||
|  | 
 | ||||||
|  |     <!--======== RESOURCES TARGETS ========--> | ||||||
|  |      | ||||||
|  |     <target name="resources" depends="-init"> | ||||||
|  |         <copy todir="${build.dir}/main/classes"> | ||||||
|  |             <fileset dir="${resources.dir}/main/"/> | ||||||
|  |         </copy> | ||||||
|  |     </target> | ||||||
|  | 
 | ||||||
|  |     <target name="resources-test" depends="-init"> | ||||||
|  |         <copy todir="${build.dir}/test/classes"> | ||||||
|  |             <fileset dir="${resources.dir}/test/"/> | ||||||
|  |         </copy> | ||||||
|  |     </target> | ||||||
|  | 
 | ||||||
|  |     <!--======== BUILD TARGETS ========--> | ||||||
|  |     <target name="-build-modular" | ||||||
|  |         depends="compile,increment-build-number,resources"> | ||||||
|  | 
 | ||||||
|  |         <jar destfile="${build.dir}/${name}-${version}.${build.number}.jar" | ||||||
|  |             basedir="${build.dir}/main/classes"/> | ||||||
|  |     </target> | ||||||
|  | 
 | ||||||
|  |     <target name="-build-packed-libs" | ||||||
|  |         depends="compile,increment-build-number,resources"> | ||||||
|  | 
 | ||||||
|  |         <unjar destdir="${build.dir}/main/classes"> | ||||||
|             <fileset dir="${build.dir}/lib/runtime/jar"/> |             <fileset dir="${build.dir}/lib/runtime/jar"/> | ||||||
|         </unjar> |         </unjar> | ||||||
| 
 | 
 | ||||||
|         <jar destfile="${build.dir}/${name}-${version}.${build.number}.jar" |         <jar destfile="${build.dir}/${name}-${version}.${build.number}.jar" | ||||||
|             basedir="${build.dir}/classes"/> |             basedir="${build.dir}/main/classes"/> | ||||||
|     </target> |     </target> | ||||||
| 
 | 
 | ||||||
|     <target name="build" depends="-build-modular"/> |     <target name="build" depends="-build-modular"/> | ||||||
		Reference in New Issue
	
	Block a user