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

589 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="5" />
<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.2"/>
<available file=".git" type="dir" property="gitDir.present"/>
<!-- <target name="git.revision" description="Store git revision in ${repository.version}" if="gitDir.present"> -->
<if>
<isset property="gitDir.present"/>
<then>
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="log"/>
<arg value="-n 1"/>
<arg value="--pretty=format:%h"/>
</exec>
</then>
</if>
<condition property="repository.version" value="${git.revision}" else="">
<and>
<isset property="git.revision"/>
<length string="${git.revision}" trim="yes" length="0" when="greater"/>
</and>
</condition>
<!-- </target> -->
<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>
<if>
<length string="${repository.version}" when="greater" length="0"/>
<then>
<var name="mutable-version" value="${mutable-version}-${repository.version}"/>
<var name="mutable-experimental-version" value="${mutable-experimental-version}-${repository.version}" />
</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="test-unit-reports.dir" value="${basedir}/test-reports" />
<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">
<property name="smack.jar.name" value="${jar.dest.dir}/smack-${version}.jar" />
<jar destfile="${smack.jar.name}"
basedir="${compile.dir}"
2014-02-03 18:38:39 +01:00
includes="org/jivesoftware/smack/**/*.class" >
<zipfileset src="${merge.lib.dir}/xpp.jar" />
<metainf dir="${basedir}/build/resources/META-INF/" includes="jul.properties smack-config.xml core.providers" />
</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" />
<jar destfile="${smackx.jar.name}"
basedir="${compile.dir}"
2014-02-03 18:38:39 +01:00
includes="org/jivesoftware/smackx/**/*.class"
excludes="org/jivesoftware/smackx/debugger/*.class">
<manifest>
<attribute name="Class-Path" value="smack.jar" />
</manifest>
2014-02-03 18:38:39 +01:00
<metainf dir="${basedir}/build/resources/META-INF/" includes="extension.providers" />
<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" />
<jar destfile="${workgroup.jar.name}"
basedir="${compile.dir}/workgroup"
2014-02-03 18:38:39 +01:00
includes="org/jivesoftware/smackx/workgroup/**/*.class">
<manifest>
<attribute name="Class-Path" value="smack.jar, smackx.jar" />
</manifest>
<metainf dir="${basedir}/workgroup/resources/META-INF/" includes="workgroup.providers" />
</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" />
<jar destfile="${experimental.jar.name}"
basedir="${compile.dir}/experimental"
2014-02-03 18:38:39 +01:00
includes="org/jivesoftware/smackx/**/*.class" >
<manifest>
<attribute name="Class-Path" value="smack.jar, smackx.jar" />
</manifest>
2014-02-03 18:38:39 +01:00
<metainf dir="${basedir}/experimental/resources/META-INF/" includes="experimental.providers" />
</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">
<jar destfile="${jar.dest.dir}/smack-test.jar"
basedir="${compile.test.dir}"
2014-02-03 18:38:39 +01:00
includes="org/jivesoftware/smack/**/*.class" >
<metainf dir="${basedir}/build/resources/META-INF/" includes="jul.properties smack-config.xml core.providers" />
</jar>
</target>
<target name="jar-test-smackx" depends="compile-test" description="Produces jar of test code">
<jar destfile="${jar.dest.dir}/smack-test-smackx.jar"
basedir="${compile.test.dir}"
2014-02-03 18:38:39 +01:00
includes="org/jivesoftware/smackx/**/*.class, org/jivesoftware/util/**/*.class" >
<metainf dir="${basedir}/build/resources/META-INF/" includes="extension.providers" />
</jar>
</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>
2014-02-06 18:18:27 +01:00
<link href="http://docs.oracle.com/javase/7/docs/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">
<mkdir dir="${test-unit-reports.dir}" />
<junit printsummary="on"
fork="false"
haltonfailure="false"
failureproperty="tests.failed"
showoutput="true"
reloading="false" >
<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"/>
<formatter type="xml" />
<batchtest todir="${test-unit-reports.dir}">
<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" depends="jar,javadoc">
<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>
<!-- 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>
2014-02-06 10:18:27 +01:00
<!-- Local Variables: -->
<!-- indent-tabs-mode: nil -->
<!-- End: -->