1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-19 09:07:57 +01:00
Smack/build/build.xml
Thiago Camargo e9fc529ac9 Add Jingle jars Ant build
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7218 b35dd754-fafc-0310-a699-88a17e54d16e
2007-02-20 17:50:29 +00:00

389 lines
15 KiB
XML

<?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 -->
<!-- ======================================================================================= -->
<!-- Smack Version -->
<property name="version.major" value="3" />
<property name="version.minor" value="0" />
<property name="version.revision" value="0" />
<property name="version.extra" value="beta2" />
<if>
<equals arg1="${version.extra}" arg2=""/>
<then>
<property name="version"
value="${version.major}.${version.minor}.${version.revision}"/>
<property name="version.filename"
value="${version.major}_${version.minor}_${version.revision}"/>
</then>
<else>
<property name="version"
value="${version.major}.${version.minor}.${version.revision}.${version.extra}"/>
<property name="version.filename"
value="${version.major}_${version.minor}_${version.revision}_${version.extra}"/>
</else>
</if>
<tstamp>
<format property="builddate" pattern="MM/dd/yyyy"/>
</tstamp>
<property file="${basedir}/build/build.properties" />
<property name="compile.dir" value="${basedir}/target/classes" />
<property name="compile.test.dir" value="${basedir}/target/classes-test" />
<property name="jar.dest.dir" value="${basedir}/target" />
<property name="javadoc.dest.dir" value="${basedir}/target/javadoc" />
<property name="merge.lib.dir" value="${basedir}/build/merge" />
<property name="test.dir" value="${basedir}/test" />
<property name="resources.dir" value="${basedir}/build/resources" />
<property name="jingle.extension.merge.lib.dir" value="${basedir}/jingle/extension/build/merge" />
<!-- 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"
source="1.5"
target="1.5"
>
<src path="${basedir}/source" />
<classpath>
<fileset dir="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
</javac>
<mkdir dir="${compile.dir}/jingle/extension" />
<javac
destdir="${compile.dir}/jingle/extension"
includeAntRuntime="no"
debug="on"
source="1.5"
target="1.5"
>
<src path="${basedir}/jingle/extension/source" />
<classpath>
<fileset dir="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${basedir}/jingle/extension/build/merge">
<include name="*.jar"/>
</fileset>
<pathelement path="${compile.dir}"/>
</classpath>
</javac>
<mkdir dir="${compile.dir}/jingle/media" />
<javac
destdir="${compile.dir}/jingle/media"
includeAntRuntime="no"
debug="on"
source="1.5"
target="1.5"
>
<src path="${basedir}/jingle/media/source" />
<classpath>
<fileset dir="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${basedir}/jingle/media/build/lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${compile.dir}"/>
<pathelement path="${compile.dir}/jingle/extension"/>
</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"
source="1.5"
target="1.5"
>
<src path="${test.dir}" />
<classpath>
<fileset dir="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${basedir}/build">
<include name="junit.jar"/>
<include name="xmlunit.jar"/>
</fileset>
<pathelement location="${compile.dir}" />
</classpath>
</javac>
</target>
<!-- jar -->
<!-- ======================================================================================= -->
<target name="jar" depends="compile" unless="jar.uptodate" description="Produces smack.jar">
<copy todir="${compile.dir}/META-INF" file="${basedir}/build/resources/META-INF/smack-config.xml" />
<jar destfile="${jar.dest.dir}/smack.jar"
basedir="${compile.dir}"
includes="org/jivesoftware/smack/**/*.class, **/smack-config.xml"
>
<zipfileset src="${merge.lib.dir}/xpp.jar"/>
</jar>
<copy todir="${compile.dir}/META-INF" file="${basedir}/build/resources/META-INF/smack.providers" />
<jar destfile="${jar.dest.dir}/smackx.jar"
basedir="${compile.dir}"
includes="org/jivesoftware/smackx/**/*.class, **/*.providers"
excludes="org/jivesoftware/smackx/debugger/*.class"
>
<manifest>
<attribute name="Class-Path" value="smack.jar" />
</manifest>
<zipfileset src="${merge.lib.dir}/jzlib.jar"/>
</jar>
<copy todir="${compile.dir}/images">
<fileset dir="${basedir}/build/resources/images">
<include name="*.png"/>
</fileset>
</copy>
<jar destfile="${jar.dest.dir}/smackx-debug.jar"
basedir="${compile.dir}"
includes="org/jivesoftware/smackx/debugger/*.class, **/*.png"
>
<manifest>
<attribute name="Class-Path" value="smack.jar" />
</manifest>
</jar>
<jar destfile="${jar.dest.dir}/jingleExtension.jar"
basedir="${compile.dir}/jingle/extension"
includes="org/jivesoftware/smackx/**/*.class"
>
<manifest>
<attribute name="Class-Path" value="smack.jar, smackx.jar" />
</manifest>
<zipfileset src="${jingle.extension.merge.lib.dir}/jstun-0.6.1.jar"/>
</jar>
<jar destfile="${jar.dest.dir}/jingleMedia.jar"
basedir="${compile.dir}/jingle/media"
includes="org/jivesoftware/**/*.class"
>
<manifest>
<attribute name="Class-Path" value="smack.jar,smackx.jar,jingleExtension.jar" />
</manifest>
</jar>
<delete file="${compile.dir}/META-INF/smack-config.xml" />
<delete file="${compile.dir}/META-INF/smack.providers" />
<delete>
<fileset dir="${compile.dir}/images">
<include name="*.png"/>
</fileset>
</delete>
</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.*"
excludepackagenames="org.jivesoftware.smack.util.collections"
sourcepath="${basedir}/source"
destdir="${javadoc.dest.dir}"
author="true"
windowtitle="Smack ${version} Documentation"
overview="${basedir}/source/overview.html"
>
<classpath>
<fileset dir="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
<doctitle><![CDATA[<font face="arial,helvetica">Smack ${version}</font>]]></doctitle>
<header><![CDATA[<b>Smack</b>]]></header>
<bottom><![CDATA[<i>Copyright &copy; 2003-2007 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="func-test" depends="compile, jar-test" unless="no.test">
<antcall target="test.messenger"/>
<antcall target="test"/>
</target>
<!-- test -->
<!-- ======================================================================================= -->
<target name="test" depends="compile, jar-test" unless="no.test">
<echo>
**** no.test: ${no.test}
</echo>
<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="true"
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="${basedir}/build">
<include name="xmlunit.jar"/>
</fileset>
<fileset dir="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${basedir}">
<include name="smack-test.jar"/>
</fileset>
<pathelement location="${compile.dir}" />
<pathelement location="${test.dir}" />
<pathelement location="${resources.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" description="Builds a release" if="release.exists" depends="release-exists">
<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}/smackx-debug.jar" />
<delete file="${basedir}/smack-test.jar" />
<delete file="${basedir}/jingleExtension.jar" />
<delete file="${basedir}/jingleMedia.jar" />
<delete dir="${basedir}/target" />
</target>
</project>