1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-30 02:02:06 +01:00
Smack/build/build.xml

571 lines
24 KiB
XML
Raw Normal View History

<?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-1.0b2.jar"/>
</classpath>
</taskdef>
<!-- PROPERTIES -->
<!-- ======================================================================================= -->
<!-- Smack Version -->
<property name="version.major" value="3" />
<property name="version.minor" value="4" />
<property name="version.revision" value="0" />
<property name="version.extra" value="SNAPSHOT" />
<var name="mutable-version" value="${version.major}.${version.minor}.${version.revision}"/>
<var name="mutable-experimental-version" value="0.1"/>
<if>
<length string="${version.extra}" when="greater" length="0"/>
<then>
<var name="mutable-version" value="${mutable-version}.${version.extra}"/>
<var name="mutable-experimental-version" value="${mutable-experimental-version}.${version.extra}" />
</then>
</if>
<if>
<equals arg1="${dailybuild}" arg2="true" />
<then>
<tstamp>
<format property="build.date" pattern="yyyyMMdd" locale="en"/>
</tstamp>
<var name="mutable-version" value="${mutable-version}-${build.date}" />
<var name="mutable-experimental-version" value="${mutable-experimental-version}-${build.date}" />
</then>
</if>
<property name="version" value="${mutable-version}" />
<property name="experimental.version" value="${mutable-experimental-version}" />
<property name="bundle.name" value="org.igniterealtime.smack" />
<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="test-unit.dir" value="${basedir}/test-unit" />
<property name="resources.dir" value="${basedir}/build/resources" />
<property name="jingle.extension.merge.lib.dir" value="${basedir}/jingle/extension/build/merge" />
<property name="jingle.extension.lib.dir" value="${basedir}/jingle/extension/build/lib" />
<!-- 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" />
<include name="org/jivesoftware/smackx/**/*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.6"
target="1.6"
>
<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.6"
target="1.6"
>
<src path="${basedir}/jingle/extension/source" />
<classpath>
<fileset dir="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${jingle.extension.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${jingle.extension.merge.lib.dir}">
<include name="*.jar"/>
</fileset>
<pathelement path="${compile.dir}"/>
</classpath>
</javac>
<mkdir dir="${compile.dir}/workgroup" />
<javac
destdir="${compile.dir}/workgroup"
includeAntRuntime="no"
debug="on"
source="1.6"
target="1.6"
>
<src path="${basedir}/workgroup/source" />
<classpath>
<fileset dir="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
<pathelement path="${compile.dir}"/>
</classpath>
</javac>
<mkdir dir="${compile.dir}/experimental" />
<javac
destdir="${compile.dir}/experimental"
includeAntRuntime="no"
debug="on"
source="1.6"
target="1.6"
>
<src path="${basedir}/experimental/source" />
<classpath>
<fileset dir="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
<pathelement path="${compile.dir}"/>
</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.6"
target="1.6"
>
<src path="${basedir}/source" />
<src path="${test.dir}" />
<src path="${test-unit.dir}" />
<classpath>
<fileset dir="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${basedir}/build">
<include name="junit-4.10.jar"/>
<include name="mockito-all-1.8.2.jar"/>
<include name="powermock-mockito-1.3.5-full.jar"/>
</fileset>
<fileset dir ="${basedir}/build/build">
<include name="xmlunit.jar"/>
<include name="java-xmlbuilder-0.3.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/jul.properties" />
<copy todir="${compile.dir}/META-INF" file="${basedir}/build/resources/META-INF/smack-config.xml" />
<copy todir="${compile.dir}/META-INF" file="${basedir}/build/resources/META-INF/core.providers" />
<property name="smack.jar.name" value="${jar.dest.dir}/smack-${version}.jar" />
<jar destfile="${smack.jar.name}"
basedir="${compile.dir}"
includes="org/jivesoftware/smack/**/*.class, **/smack-config.xml, **/core.providers, **/jul.properties">
<zipfileset src="${merge.lib.dir}/xpp.jar"/>
</jar>
<taskdef resource="aQute/bnd/ant/taskdef.properties" classpath="${basedir}/build/build/biz.aQute.bnd.jar"/>
<bndwrap jars="${smack.jar.name}" output="${smack.jar.name}" />
<jar file="${smack.jar.name}" update="true">
<manifest>
<attribute name="Bundle-SymbolicName" value="${bundle.name}" />
<attribute name="Bundle-Version" value="${version}" />
</manifest>
</jar>
<property name="smackx.jar.name" value="${jar.dest.dir}/smackx-${version}.jar" />
<copy todir="${compile.dir}/META-INF" file="${basedir}/build/resources/META-INF/extension.providers" />
<jar destfile="${smackx.jar.name}"
basedir="${compile.dir}"
includes="org/jivesoftware/smackx/**/*.class, **/extension.providers"
excludes="org/jivesoftware/smackx/debugger/*.class">
<manifest>
<attribute name="Class-Path" value="smack.jar" />
</manifest>
<zipfileset src="${merge.lib.dir}/jzlib.jar"/>
</jar>
<bndwrap jars="${smackx.jar.name}" output="${smackx.jar.name}" />
<jar file="${smackx.jar.name}" update="true">
<manifest>
<attribute name="Bundle-SymbolicName" value="${bundle.name}-ext" />
<attribute name="Bundle-Version" value="${version}" />
<attribute name="Fragment-Host" value="${bundle.name};bundle-version=${version}" />
</manifest>
</jar>
<property name="debug.jar.name" value="${jar.dest.dir}/smackx-debug-${version}.jar" />
<copy todir="${compile.dir}/images">
<fileset dir="${basedir}/build/resources/images">
<include name="*.png"/>
</fileset>
</copy>
<jar destfile="${debug.jar.name}"
basedir="${compile.dir}"
includes="org/jivesoftware/smackx/debugger/*.class, **/*.png">
<manifest>
<attribute name="Class-Path" value="smack.jar" />
</manifest>
</jar>
<bndwrap jars="${debug.jar.name}" output="${debug.jar.name}" />
<jar file="${debug.jar.name}" update="true">
<manifest>
<attribute name="Bundle-SymbolicName" value="${bundle.name}-debug" />
<attribute name="Bundle-Version" value="${version}" />
<attribute name="Fragment-Host" value="${bundle.name};bundle-version=${version}" />
</manifest>
</jar>
<property name="jingle.jar.name" value="${jar.dest.dir}/smackx-jingle-${version}.jar" />
<jar destfile="${jingle.jar.name}"
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.jar"/>
</jar>
<bndwrap jars="${jingle.jar.name}" output="${jingle.jar.name}" />
<jar file="${jingle.jar.name}" update="true">
<manifest>
<attribute name="Bundle-SymbolicName" value="${bundle.name}-jingle" />
<attribute name="Bundle-Version" value="${version}" />
<attribute name="Fragment-Host" value="${bundle.name};bundle-version=${version}" />
</manifest>
</jar>
<property name="workgroup.jar.name" value="${jar.dest.dir}/smackx-workgroup-${version}.jar" />
<copy todir="${compile.dir}/workgroup/META-INF" file="${basedir}/workgroup/resources/META-INF/workgroup.providers" />
<jar destfile="${workgroup.jar.name}"
basedir="${compile.dir}/workgroup"
includes="org/jivesoftware/smackx/workgroup/**/*.class, **/workgroup.providers">
<manifest>
<attribute name="Class-Path" value="smack.jar, smackx.jar" />
</manifest>
</jar>
<bndwrap jars="${workgroup.jar.name}" output="${workgroup.jar.name}" />
<jar file="${workgroup.jar.name}" update="true">
<manifest>
<attribute name="Bundle-SymbolicName" value="${bundle.name}-workgroup" />
<attribute name="Bundle-Version" value="${version}" />
<attribute name="Fragment-Host" value="${bundle.name};bundle-version=${version}" />
</manifest>
</jar>
<property name="experimental.jar.name" value="${jar.dest.dir}/smackx-experimental-${experimental.version}.jar" />
<copy todir="${compile.dir}/experimental/META-INF" file="${basedir}/experimental/resources/META-INF/experimental.providers" />
<jar destfile="${experimental.jar.name}"
basedir="${compile.dir}/experimental"
includes="org/jivesoftware/smackx/**/*.class, **/experimental.providers">
<manifest>
<attribute name="Class-Path" value="smack.jar, smackx.jar" />
</manifest>
</jar>
<bndwrap jars="${experimental.jar.name}" output="${experimental.jar.name}" />
<jar file="${experimental.jar.name}" update="true">
<manifest>
<attribute name="Bundle-SymbolicName" value="${bundle.name}-experimental" />
<attribute name="Bundle-Version" value="${version}" />
<attribute name="Fragment-Host" value="${bundle.name};bundle-version=${experimental.version}" />
</manifest>
</jar>
<!--
<delete file="${compile.dir}/META-INF/smack-config.xml" />
<delete file="${compile.dir}/META-INF/*.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">
<copy todir="${compile.test.dir}/META-INF" file="${basedir}/build/resources/META-INF/jul.properties" />
<copy todir="${compile.test.dir}/META-INF" file="${basedir}/build/resources/META-INF/smack-config.xml" />
<copy todir="${compile.test.dir}/META-INF" file="${basedir}/build/resources/META-INF/core.providers" />
<jar destfile="${jar.dest.dir}/smack-test.jar"
basedir="${compile.test.dir}"
includes="org/jivesoftware/smack/**/*.class, **/smack-config.xml, **/core.providers, **/jul.properties"
/>
</target>
<target name="jar-test-smackx" depends="compile-test" description="Produces jar of test code">
<copy todir="${compile.test.dir}/META-INF" file="${basedir}/build/resources/META-INF/extension.providers" />
<jar destfile="${jar.dest.dir}/smack-test-smackx.jar"
basedir="${compile.test.dir}"
includes="org/jivesoftware/smackx/**/*.class, org/jivesoftware/util/**/*.class, **/extension.providers"
/>
</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="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${basedir}/build">
<include name="junit-4.10.jar"/>
<include name="mockito-all-1.8.2.jar"/>
<include name="powermock-mockito-1.3.5-full.jar"/>
</fileset>
<fileset dir ="${basedir}/build/build">
<include name="xmlunit.jar"/>
<include name="java-xmlbuilder-0.3.jar" />
</fileset>
<fileset dir="${jar.dest.dir}">
<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-unit -->
<!-- ======================================================================================= -->
<target name="test-unit" depends="compile, jar-test, jar-test-smackx" unless="no.test">
<junit printsummary="on"
fork="false"
haltonfailure="false"
failureproperty="tests.failed"
showoutput="true">
<classpath>
<fileset dir="${merge.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${basedir}/build">
<include name="junit-4.10.jar"/>
<include name="mockito-all-1.8.2.jar"/>
<include name="powermock-mockito-1.3.5-full.jar"/>
</fileset>
<fileset dir ="${basedir}/build/build">
<include name="xmlunit.jar"/>
<include name="java-xmlbuilder-0.3.jar" />
</fileset>
<fileset dir="${jar.dest.dir}">
<include name="smack-test.jar"/>
<include name="smack-test-smackx.jar" />
</fileset>
<pathelement location="${compile.dir}" />
<pathelement location="${test-unit.dir}" />
<pathelement location="${resources.dir}" />
</classpath>
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${basedir}/test-unit">
<patternset refid="test.cases" />
</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>
<!-- checkcode -->
<!-- ======================================================================================= -->
<target name="checkcode" >
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
<classpath>
<pathelement location="${basedir}/build/pmd.jar" />
<pathelement location="${basedir}/build/asm.jar" />
<pathelement location="${basedir}/build/jaxen.jar" />
</classpath>
</taskdef>
<pmd shortFilenames="true">
<ruleset>migrating</ruleset>
<ruleset>finalizers</ruleset>
<formatter type="html" toFile="target/pmd_report.html" toConsole="true" />
<fileset dir="source/">
<include name="**/*.java" />
</fileset>
</pmd>
</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}/smackx-test.jar" />
<delete file="${basedir}/smackx-jingle.jar" />
<delete dir="${basedir}/target" />
</target>
</project>