<?xml version="1.0"?> <!-- Smack Build Script ========================================== --> <!-- Jive Software ============================================== --> <!-- $RCSfile$ $Revision$ $Date$ --> <project name="Smack" default="all" basedir=".."> <!-- TASKDEFS --> <!-- ======================================================================================= --> <!-- ======================================================================================= --> <taskdef resource="net/sf/antcontrib/antcontrib.properties"> <classpath> <pathelement location="${basedir}/build/ant-contrib.jar"/> </classpath> </taskdef> <!-- PROPERTIES --> <!-- ======================================================================================= --> <property file="${basedir}/build/build.properties" /> <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="javadoc.dest.dir" value="${basedir}/javadoc" /> <property name="build.lib.dir" value="${basedir}/build/lib" /> <property name="merge.lib.dir" value="${basedir}/build/merge" /> <property name="version.major" value="1" /> <property name="version.minor" value="2" /> <property name="version.revision" value="1" /> <property name="version.name" value="${version.major}.${version.minor}.${version.revision}" /> <!-- Test props - override these defaults in the properties file or in command line --> <property name="test.host" value="localhost" /> <property name="test.port" value="5222" /> <property name="test.admin.username" value="admin" /> <property name="test.admin.password" value="admin" /> <property name="test.admin.resource" value="Test" /> <property name="test.smack.debug" value="false" /> <!-- PATHS, DEPENDIENCIES, PATTERNS --> <!-- ======================================================================================= --> <!-- ======================================================================================= --> <patternset id="test.cases"> <include name="org/jivesoftware/smack/**/*Test.java" /> <exclude name="org/jivesoftware/smack/**/Messenger*Test.java" /> </patternset> <patternset id="messenger.test.cases"> <include name="org/jivesoftware/smack/**/Messenger*Test.java" /> </patternset> <!-- TARGETS --> <!-- ======================================================================================= --> <!-- all --> <!-- ======================================================================================= --> <target name="all" depends="jar" description="Calls 'jar' target by default"> </target> <!-- compile --> <!-- ======================================================================================= --> <target name="compile" description="Compiles all source to ${compile.dir}."> <!-- make target dir --> <mkdir dir="${compile.dir}" /> <javac destdir="${compile.dir}" includeAntRuntime="no" debug="on" > <src path="${basedir}/source" /> <classpath> <fileset dir="${build.lib.dir}"> <include name="*.jar"/> </fileset> <fileset dir="${merge.lib.dir}"> <include name="*.jar"/> </fileset> </classpath> </javac> </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 --> <!-- ======================================================================================= --> <target name="jar" depends="compile" unless="jar.uptodate" description="Produces smack.jar"> <jar destfile="${jar.dest.dir}/smack.jar" basedir="${compile.dir}" includes="org/jivesoftware/smack/**/*.class" > <zipfileset src="${merge.lib.dir}/xpp.jar"/> </jar> <copy todir="${compile.dir}/META-INF" file="${basedir}/resources/META-INF/smack.providers" /> <jar destfile="${jar.dest.dir}/smackx.jar" basedir="${compile.dir}" includes="org/jivesoftware/smackx/**/*.class, **/*.providers" /> <delete file="${compile.dir}/META-INF/smack.providers" /> </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 --> <!-- ======================================================================================= --> <target name="javadoc" description="JavaDocs the Smack source code"> <mkdir dir="${javadoc.dest.dir}" /> <javadoc packagenames="org.jivesoftware.smack.*, org.jivesoftware.smackx.*" sourcepath="${basedir}/source" destdir="${javadoc.dest.dir}" author="true" windowtitle="Smack ${version.name} Documentation" overview="${basedir}/source/overview.html" > <classpath> <fileset dir="${build.lib.dir}"> <include name="*.jar"/> </fileset> <fileset dir="${merge.lib.dir}"> <include name="*.jar"/> </fileset> </classpath> <doctitle><![CDATA[<font face="arial,helvetica">Smack ${version.name}</font>]]></doctitle> <header><![CDATA[<b>Smack</b>]]></header> <bottom><![CDATA[<i>Copyright © 2003 Jive Software. </i>]]></bottom> <link href="http://java.sun.com/j2se/1.3/docs/api/" /> <link href="http://java.sun.com/j2ee/sdk_1.2.1/techdocs/api/" /> </javadoc> </target> <!-- test --> <!-- ======================================================================================= --> <target name="test" depends="compile, jar-test" unless="no.test"> <property name="test.messenger" value="false" /> <if> <not><equals arg1="test.messenger" arg2="true" /></not> <then> <property name="test.classes" value="test.cases" /> </then> </if> <junit printsummary="on" fork="false" haltonfailure="false" failureproperty="tests.failed" showoutput="true"> <sysproperty key="smack.test.host" value="${test.host}" /> <sysproperty key="smack.test.port" value="${test.port}" /> <sysproperty key="smack.test.admin.username" value="${test.admin.username}" /> <sysproperty key="smack.test.admin.password" value="${test.admin.password}" /> <sysproperty key="smack.test.admin.resource" value="${test.admin.resource}" /> <sysproperty key="smack.debug" value="${test.smack.debug}" /> <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"> <patternset refid="${test.classes}" /> </fileset> </batchtest> </junit> <fail if="tests.failed" message="** Tests failed, see test log. **" /> </target> <!-- test --> <!-- ======================================================================================= --> <target name="test.messenger" depends="compile, jar-test" unless="no.test"> <antcall target="test" inheritall="true" inheritrefs="true"> <param name="test.messenger" value="true" /> <param name="test.classes" value="messenger.test.cases" /> </antcall> </target> <!-- release --> <!-- ======================================================================================= --> <target name="release" if="release.exists" depends="release-exists, test"> <antcall target="jar"> <param name="no.test" value="true" /> </antcall> <antcall target="javadoc"> <param name="no.test" value="true" /> </antcall> <ant antfile="${basedir}/build/release.xml" /> </target> <!-- release-exists --> <!-- ======================================================================================= --> <target name="release-exists" > <available file="${basedir}/build/release.xml" property="release.exists"/> </target> <!-- clean --> <!-- ======================================================================================= --> <target name="clean" description="Deletes all generated content."> <delete dir="${javadoc.dest.dir}" /> <delete dir="${compile.dir}" /> <delete dir="${compile.test.dir}" /> <delete file="${basedir}/smack.jar" /> <delete file="${basedir}/smackx.jar" /> <delete file="${basedir}/smack-test.jar" /> <delete dir="${basedir}/release" /> </target> </project>