1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-16 20:22:05 +01:00

Added test and test support targets

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2001 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Bill Lynch 2003-08-02 17:32:38 +00:00 committed by blynch
parent 43ab5f8bd5
commit bea40b744c

View file

@ -11,10 +11,28 @@
<project name="Smack" default="all" basedir=".."> <project name="Smack" default="all" basedir="..">
<!-- TASKDEFS -->
<!-- ======================================================================================= -->
<!-- org.apache.tools.ant.taskdefs.optional.junit.JUnitTask -->
<!-- <taskdef resource="junit.properties">-->
<!-- <classpath>-->
<!-- <pathelement location="${basedir}/build/ant.jar"/>-->
<!-- <pathelement location="${basedir}/build/junit.jar"/>-->
<!-- </classpath>-->
<!-- </taskdef>-->
<!-- <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">-->
<!-- <classpath>-->
<!-- <pathelement location="${basedir}/build/ant.jar"/>-->
<!-- <pathelement location="${basedir}/build/junit.jar"/>-->
<!-- </classpath>-->
<!-- </taskdef>-->
<!-- PROPERTIES --> <!-- PROPERTIES -->
<!-- ======================================================================================= --> <!-- ======================================================================================= -->
<property name="compile.dir" value="${basedir}/classes" /> <property name="compile.dir" value="${basedir}/classes" />
<property name="compile.test.dir" value="${basedir}/classes-test" />
<property name="jar.dest.dir" value="${basedir}" /> <property name="jar.dest.dir" value="${basedir}" />
<property name="javadoc.dest.dir" value="${basedir}/javadoc" /> <property name="javadoc.dest.dir" value="${basedir}/javadoc" />
<property name="build.lib.dir" value="${basedir}/build/lib" /> <property name="build.lib.dir" value="${basedir}/build/lib" />
@ -55,9 +73,35 @@
</javac> </javac>
</target> </target>
<!-- compile-test -->
<!-- ======================================================================================= -->
<target name="compile-test" description="Compiles all source to ${compile.dir}.">
<!-- make target dir -->
<mkdir dir="${compile.test.dir}" />
<javac
destdir="${compile.test.dir}"
includeAntRuntime="no"
debug="on"
>
<src path="${basedir}/test" />
<classpath>
<fileset dir="${build.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${basedir}/build">
<include name="junit.jar"/>
</fileset>
<pathelement location="${compile.dir}" />
</classpath>
</javac>
</target>
<!-- jar --> <!-- jar -->
<!-- ======================================================================================= --> <!-- ======================================================================================= -->
<target name="jar" depends="compile" unless="jar.uptodate" description="Produces smack.jar"> <target name="jar" depends="compile, test" unless="jar.uptodate" description="Produces smack.jar">
<jar destfile="${jar.dest.dir}/smack.jar" <jar destfile="${jar.dest.dir}/smack.jar"
basedir="${compile.dir}" basedir="${compile.dir}"
includes="org/jivesoftware/smack/**/*.class" includes="org/jivesoftware/smack/**/*.class"
@ -72,6 +116,15 @@
</jar> </jar>
</target> </target>
<!-- jar -->
<!-- ======================================================================================= -->
<target name="jar-test" depends="compile-test" description="Produces jar of test code">
<jar destfile="${jar.dest.dir}/smack-test.jar"
basedir="${compile.test.dir}"
includes="org/jivesoftware/smack/**/*.class"
/>
</target>
<!-- javadoc --> <!-- javadoc -->
<!-- ======================================================================================= --> <!-- ======================================================================================= -->
<target name="javadoc" description="JavaDocs the Jive Forums source code"> <target name="javadoc" description="JavaDocs the Jive Forums source code">
@ -102,9 +155,44 @@
</target> </target>
<!-- test -->
<!-- ======================================================================================= -->
<target name="test" depends="compile, jar-test" unless="no.test">
<junit printsummary="on"
fork="false"
haltonfailure="false"
failureproperty="tests.failed"
showoutput="true">
<classpath>
<fileset dir="${build.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${basedir}">
<include name="smack-test.jar"/>
</fileset>
<pathelement location="${compile.dir}" />
</classpath>
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${basedir}/test">
<include name="org/jivesoftware/smack/**/*Test.java"/>
</fileset>
</batchtest>
</junit>
<fail if="tests.failed" message="Tests failed, see test log." />
</target>
<!-- release --> <!-- release -->
<!-- ======================================================================================= --> <!-- ======================================================================================= -->
<target name="release" if="release.exists" depends="release-exists"> <target name="release" if="release.exists" depends="release-exists, test">
<antcall target="jar" /> <antcall target="jar" />
<antcall target="javadoc" /> <antcall target="javadoc" />
<ant antfile="${basedir}/build/release.xml" /> <ant antfile="${basedir}/build/release.xml" />
@ -123,7 +211,10 @@
<target name="clean" description="Deletes all generated content."> <target name="clean" description="Deletes all generated content.">
<delete dir="${javadoc.dest.dir}" /> <delete dir="${javadoc.dest.dir}" />
<delete dir="${compile.dir}" /> <delete dir="${compile.dir}" />
<delete dir="${compile.test.dir}" />
<delete file="${basedir}/smack.jar" /> <delete file="${basedir}/smack.jar" />
<delete file="${basedir}/smackx.jar" />
<delete file="${basedir}/smack-test.jar" />
<delete dir="${basedir}/release" /> <delete dir="${basedir}/release" />
</target> </target>