Files
Spark/build/build.xml
2016-11-25 20:37:12 +02:00

1145 lines
40 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project name="Spark" default="release" basedir="..">
<description>
Spark build script.
</description>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/build/lib/ant-contrib.jar"/>
</classpath>
</taskdef>
<taskdef name="pack200" classname="com.sun.tools.apache.ant.pack200.Pack200Task">
<classpath>
<pathelement location="${basedir}/build/lib/pack200task.jar"/>
</classpath>
</taskdef>
<!-- Optional add this file to override any of the properties below -->
<property file="${basedir}/build/build.properties"/>
<property name="version.major" value="2"/>
<property name="version.minor" value="8"/>
<property name="version.revision" value="2"/>
<!-- Spark Build Number
Passed into ant via cmd line argument:
-Dbuild.number=<build number>
Left blank if omitted.
-->
<if>
<contains string="${build.number}" substring="build.number"/>
<then>
<property name="version.extra" value=""/>
</then>
<else>
<property name="version.extra" value="${build.number}"/>
</else>
</if>
<!--
<loadfile property="version.extra" srcFile="./.svn/entries">
<filterchain>
<headfilter lines="1" skip="3"/>
<deletecharacters chars="\n"/>
</filterchain>
</loadfile> -->
<!-- For 'beta' or 'alpha' -->
<!-- Setup the full version property correctly -->
<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>
<description>Spark Build</description>
<!--set global properties for this build-->
<property name="src" location="${basedir}/src/java"/>
<property name="patch.dir" location="${basedir}/patches/"/>
<property name="lib.dir" location="${basedir}/build/lib"/>
<property name="dist.libs.dir" location="${basedir}/build/lib/dist"/>
<property name="merge.libs.dir" location="${basedir}/build/lib/merge"/>
<property name="libs.windows.dir" location="${dist.libs.dir}/windows"/>
<property name="libs.linux.dir" location="${dist.libs.dir}/linux"/>
<property name="libs.mac.dir" location="${dist.libs.dir}/mac"/>
<property name="target" location="${basedir}/target"/>
<property name="classes" location="${target}/classes"/>
<property name="test.classes" location="${target}/classestest"/>
<property name="test.src" location="${basedir}/src/test"/>
<property name="target.build" location="${target}/build"/>
<property name="sparkplugs.build" location="${target}/sparkplugs"/>
<property name="target.resources" location="${target.build}/resources"/>
<property name="targetlib" location="${target.build}/lib"/>
<property name="targetlogs" location="${target.build}/logs"/>
<property name="targetdocs" location="${target.build}/documentation"/>
<property name="targetdocsapi" location="${targetdocs}/api"/>
<property name="plugins" location="${target.build}/plugins"/>
<property name="bin" location="${target.build}/bin"/>
<property name="resources.dir" location="${basedir}/src/resources"/>
<property name="commercial.plugin.dir" location="${basedir}/src/commercial"/>
<property name="xtra.dir" location="${basedir}/src/xtra"/>
<property name="target.xtra" location="${target.build}/xtra"/>
<property name="release.dir" value="${basedir}/installer"/>
<property name="proxy.host" value=""/>
<property name="proxy.port" value=""/>
<property name="proxy.user" value=""/>
<property name="proxy.pass" value=""/>
<property name="proxy.enabled" value=""/>
<!-- Installer Ant Script -->
<property name="installer.install4j.home" value="/home/j2ee-bamboo/install4j"/>
<property name="installer.dest.dir" value="${target}/installer"/>
<property name="installer.install4j.srcfile" value="${basedir}/build/installer/spark.install4j"/>
<property name="installer.app_name" value="Spark"/>
<property name="installer.app_short_name" value="Spark"/>
<property name="installer.product_name" value="Spark"/>
<property name="installer.publisher" value="Ignite Realtime"/>
<property name="installer.publisher_url" value="www.igniterealtime.org"/>
<property name="installer.file_prefix" value="${installer.app_short_name}"/>
<property name="installer.release_root_path" value="${target.build}"/>
<property name="advinst.path" value="C:\Programme\Caphyon\Advanced Installer 7.2.1"/>
<property name="mac.build.dir" value="${target}/spark_app"/>
<property name="mac.app.file" value="${mac.build.dir}/Spark.app"/>
<property name="mac.dmg.file" value="${target}/installer/spark_${version.filename}.dmg"/>
<property name="mac.volname" value="Spark_${version.major}.${version.minor}.${version.revision}"/>
<!-- LOCAL PATH for MAC JRE files -->
<property name="mac.jre.localdir" value="/Users/j2ee-bamboo/jres"/>
<property name="win.msi.withjre" value="${basedir}\installer\spark_${version.filename}.msi"/>
<property name="win.msi.nojre" value="${basedir}\installer\spark_${version.filename}_online.msi"/>
<property name="pack200.excludes"
value="jingle.jar,mail.jar,activation.jar,dom4j.jar,startup.jar,base.jar,i4jruntime.jar"/>
<!-- IzPack Installer -->
<property name="installer.izpack.dir" value="c:/progra~1/IzPack/" />
<property name="launch4j.dir" location="c:/progra~2/Launch4j/" />
<!-- Inno Setup -->
<property name="innosetup.dir" location="C:\\Programme\\Inno Setup 5\\" />
<!-- Pack200 Config -->
<property name="pack200.enabled" value="false"/>
<!-- User Defined Properties -->
<property file="build.properties"/>
<!-- Define Default Library Archives -->
<path id="agent.dependencies">
<fileset dir="${dist.libs.dir}" includes="*.jar"/>
<fileset dir="${merge.libs.dir}" includes="*.jar"/>
<fileset dir="${libs.windows.dir}" includes="*.jar"/>
<fileset dir="${lib.dir}" includes="*.jar"/>
</path>
<!-- clean =================================================================================== -->
<target name="clean" description="Deletes files generated during the build.">
<!--Delete created directory trees-->
<delete failonerror="false">
<fileset dir="${target}" followsymlinks="false"/>
</delete>
<delete dir="${release.dir}" failonerror="false" followsymlinks="false" />
<delete dir="${basedir}/work" failonerror="false" followsymlinks="false" />
</target>
<!-- init =================================================================================== -->
<target name="init">
<!-- Check for min build requirements -->
<condition property="ant.not.ok" value="true">
<not>
<antversion atleast="1.7.1"/>
</not>
</condition>
<condition property="java.not.ok" value="true">
<not>
<or>
<contains string="${java.version}" substring="1.8"/>
<contains string="${java.version}" substring="1.9"/>
</or>
</not>
</condition>
<fail if="ant.not.ok" message="Must use Ant 1.7.1 or higher to build Spark."/>
<fail if="java.not.ok" message="Must use JDK 1.8.x or higher to build Spark. Found: ${java.version}"/>
<!-- Platform-specific initializations -->
<condition property="windows">
<os family="windows"/>
</condition>
<condition property="unix">
<os family="unix"/>
</condition>
<condition property="solaris">
<os name="SunOS"/>
</condition>
<condition property="linux">
<os name="Linux"/>
</condition>
<condition property="mac">
<os name="Mac OS X"/>
</condition>
<!--creates the build directory-->
<mkdir dir="${target}"/>
<mkdir dir="${classes}"/>
<mkdir dir="${target.build}"/>
<mkdir dir="${target.resources}"/>
<mkdir dir="${targetlib}"/>
<mkdir dir="${targetlogs}"/>
<mkdir dir="${targetdocs}"/>
<mkdir dir="${plugins}"/>
<mkdir dir="${bin}"/>
<mkdir dir="${target.xtra}"/>
<!-- set APPLICATION_VERSION in default.properties -->
<replaceregexp file="${src}/org/jivesoftware/resource/default.properties"
match="APPLICATION_VERSION =.*"
replace="APPLICATION_VERSION = ${version.major}.${version.minor}.${version.revision}"
byline="true">
</replaceregexp>
<!-- set BUILD_NUMBER in default.properties -->
<replaceregexp file="${src}/org/jivesoftware/resource/default.properties"
match="BUILD_NUMBER =.*" replace="BUILD_NUMBER = ${version.extra}"
byline="false">
</replaceregexp>
</target>
<!-- patch =================================================================================== -->
<target name="patch">
<for param="patch">
<path>
<fileset dir="${patch.dir}" includes="*.patch" />
</path>
<sequential>
<patch patchfile="@{patch}" dir="${basedir}/src" strip="1"/>
</sequential>
</for>
</target>
<!-- resources =================================================================================== -->
<target name="resources">
<copy todir="${classes}">
<fileset dir="${resources.dir}">
<include name="**/*"/>
</fileset>
<fileset dir="${basedir}/src/java">
<include name="**/*.properties"/>
</fileset>
</copy>
<copy todir="${target.resources}">
<fileset dir="${resources.dir}">
<exclude name="*.bat"/>
<exclude name="settings.xml"/>
<include name="*.*"/>
</fileset>
</copy>
<copy todir="${target.resources}/sounds">
<fileset dir="${resources.dir}/sounds">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="${plugins}">
<fileset dir="${commercial.plugin.dir}">
<include name="*.jar"/>
</fileset>
</copy>
<copy todir="${target.xtra}">
<fileset dir="${xtra.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
</target>
<!-- build =================================================================================== -->
<target name="build" depends="init, resources, base, checkcode.checkstyle">
<echo message="${ant.version}"/>
<echo message="Java Version: ${ant.java.version}"/>
<!--Compiles the java code from ${src} directory into ${classes} directory-->
<javac destdir="${classes}"
debug="true"
source="1.8"
target="1.8"
includeantruntime="false"
>
<compilerarg value="-Xlint:deprecation" />
<classpath>
<path refid="agent.dependencies"/>
</classpath>
<src path="${src}"/>
</javac>
<touch file="${targetlogs}/error.log"/>
<copy todir="${targetdocs}">
<fileset dir="${basedir}/documentation" includes="**/*" excludes="changes.*">
</fileset>
</copy>
<copy todir="${targetlib}/windows">
<fileset dir="${libs.windows.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${targetlib}/linux">
<fileset dir="${libs.linux.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${targetlib}/mac">
<fileset dir="${libs.mac.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${targetlib}">
<fileset dir="${dist.libs.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${targetlib}">
<fileset dir="${basedir}/build/lib">
<include name="i4jruntime.jar"/>
</fileset>
</copy>
<copy todir="${bin}">
<fileset dir="${resources.dir}">
<include name="startup.bat"/>
<include name="startup.sh"/>
</fileset>
</copy>
<chmod file="${bin}/startup.sh" perm="+x"/>
</target>
<!-- jar =================================================================================== -->
<target name="jar" depends="build">
<!--Put everything in ${classes} into the MyProject-${DSTAMP}.jar file-->
<tstamp/>
<!-- Make startup jar -->
<jar jarfile="${targetlib}/startup.jar">
<fileset dir="${classes}">
<include name="org/jivesoftware/launcher/*.class"/>
</fileset>
<manifest>
<attribute name="Main-Class"
value="org.jivesoftware.launcher.Startup"/>
<attribute name="Built-By" value="Ignite Realtime (www.igniterealtime.org)"/>
</manifest>
</jar>
<jar jarfile="${targetlib}/spark.jar" basedir="${classes}" excludes="org/jivesoftware/Startup.class"/>
</target>
<target name="release" depends="jar">
<if>
<equals arg1="${pack200.enabled}" arg2="true"/>
<then>
<!-- Pack200 on all jars -->
<for param="jar">
<path>
<fileset dir="${targetlib}" includes="*.jar" excludes="${pack200.excludes}"/>
</path>
<sequential>
<delete file="@{jar}.pack"/>
<pack200 src="@{jar}"
destfile="@{jar}.pack"
gzipoutput="false"
/>
<delete file="@{jar}"/>
</sequential>
</for>
<!-- Pack200 all plugins -->
<for param="jar">
<path>
<fileset dir="${plugins}" includes="*.jar" excludes="${pack200.excludes}"/>
</path>
<sequential>
<delete file="@{jar}.pack"/>
<pack200 src="@{jar}"
destfile="@{jar}.pack"
gzipoutput="false"
/>
<delete file="@{jar}"/>
</sequential>
</for>
</then>
</if>
</target>
<target name="build.plugins">
<subant target="">
<fileset dir="./src/plugins/fastpath/" includes="*/build.xml" />
</subant>
<subant target="">
<fileset dir="./src/plugins/google/" includes="*/build.xml" />
</subant>
<subant target="">
<fileset dir="./src/plugins/jingle/" includes="*/build.xml" />
</subant>
<subant target="">
<fileset dir="./src/plugins/sip/" includes="*/build.xml" />
</subant>
<subant target="">
<fileset dir="./src/plugins/spelling/" includes="*/build.xml" />
</subant>
<subant target="">
<fileset dir="./src/plugins/roar/" includes="*/build.xml" />
</subant>
<subant target="">
<fileset dir="./src/plugins/transferguard/" includes="*/build.xml" />
</subant>
<!-- <subant target="">
<fileset dir="./src/plugins/translator/" includes="*/build.xml" />
</subant>
-->
<subant target="">
<fileset dir="./src/plugins/otr/" includes="*/build.xml" />
</subant>
<!-- <subant target="">
<fileset dir="./src/plugins/reversi/" includes="*/build.xml" />
</subant>
<subant target="">
<fileset dir="./src/plugins/tictactoe/" includes="*/build.xml" />
</subant>
<subant target="">
<fileset dir="./src/plugins/battleships/" includes="*/build.xml" />
</subant>
-->
<copy todir="${plugins}">
<fileset dir="${commercial.plugin.dir}">
<include name="*.jar"/>
</fileset>
</copy>
</target>
<target name="windows.build.plugins" depends="build.plugins">
<subant target="">
<fileset dir="./src/plugins/flashing/" includes="*/build.xml" />
</subant>
<copy todir="${plugins}">
<fileset dir="${commercial.plugin.dir}">
<include name="flashing.jar" />
</fileset>
</copy>
</target>
<target name="linux.build.plugins" depends="build.plugins">
<subant target="">
<fileset dir="./src/plugins/linux/" includes="*/build.xml" />
</subant>
</target>
<!-- exe =================================================================================== -->
<target name="exe" depends="jar,windows.build.plugins">
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />
<copy file="${basedir}/build/installer/izpack/launch4j.tmpl" tofile="${basedir}/build/installer/izpack/launch4j.xml" />
<copy file="${basedir}/build/installer/izpack/launch4j-starter.tmpl" tofile="${basedir}/build/installer/izpack/launch4j-starter.xml" />
<replace file="${basedir}/build/installer/izpack/launch4j.xml" token="@SPARKDIR@" value="${basedir}/target/build/" />
<replace file="${basedir}/build/installer/izpack/launch4j-starter.xml" token="@SPARKDIR@" value="${basedir}/target/build/" />
<launch4j configFile="${basedir}/build/installer/izpack/launch4j.xml" tmpdir="${basedir}" />
<launch4j configFile="${basedir}/build/installer/izpack/launch4j-starter.xml" tmpdir="${basedir}" />
</target>
<!-- javadocs =================================================================================== -->
<target name="release.javadocs" depends="jar, javadocs"
description="creates javadocs version for developer source builds">
</target>
<!-- base =================================================================================== -->
<target name="base" depends="init" description="Produces Base Jars For Spark">
<mkdir dir="${targetlib}" />
<!-- Make main Messenger jar -->
<jar jarfile="${targetlib}/base.jar" index="true">
<zipgroupfileset dir="${merge.libs.dir}" includes="*.jar" />
<manifest>
<attribute name="Built-By" value="Ignite Realtime (www.igniterealtime.org)" />
</manifest>
</jar>
</target>
<!-- javadocs =================================================================================== -->
<target name="javadocs" depends="init">
<mkdir dir="${targetdocsapi}" />
<javadoc destdir="${targetdocsapi}" author="true" version="true" use="true" windowtitle="API for Agent" useexternalfile="yes">
<classpath>
<path refid="agent.dependencies"/>
</classpath>
<fileset dir="${src}" defaultexcludes="yes">
<exclude name="**/*.properties"/>
<exclude name="**/*.html"/>
</fileset>
</javadoc>
</target>
<!-- changelog =============================================================================== -->
<target name="changelog"
description="Generates an incremental changelog file based upon the XML/RSS feed from JIRA">
<xslt in="${basedir}/documentation/changes.xml" out="${basedir}/target/changes.html"
style="${basedir}/documentation/changes.xsl"/>
</target>
<!-- tests =================================================================================== -->
<target name="build_tests" depends="build">
<mkdir dir="${test.classes}" />
<javac destdir="${test.classes}"
debug="true"
source="1.8"
target="1.8"
>
<compilerarg value="-Xlint:deprecation" />
<classpath>
<path refid="agent.dependencies"/>
<pathelement location="${classes}" />
</classpath>
<src path="${test.src}"/>
</javac>
</target>
<target name="run_tests" depends="build, build_tests">
<junit printsummary="on"
fork="true"
haltonfailure="false"
showoutput="true">
<classpath>
<path refid="agent.dependencies"/>
<pathelement location="${classes}" />
<pathelement location="${test.classes}" />
</classpath>
<batchtest>
<fileset dir="${basedir}/src/test">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="report" depends="run_tests">
<!--
<junitreport todir="${reports}">
<fileset dir="${reports}">
<include name="TEST-*.xml"/>
</fileset>
<report format="noframes" todir="${htmlreports}"/>
</junitreport>
-->
</target>
<target name="development" depends="clean, jar, javadocs"
description="Creates a development environment for Sparkplugs">
<mkdir dir="${sparkplugs.build}"/>
<mkdir dir="${sparkplugs.build}/spark"/>
<mkdir dir="${sparkplugs.build}/builder"/>
<mkdir dir="${sparkplugs.build}/images"/>
<mkdir dir="${sparkplugs.build}/api"/>
<copy todir="${sparkplugs.build}/spark">
<fileset file="${target.resources}" includes="**/*"/>
<fileset file="${targetlib}" includes="**/*"/>
<fileset file="${plugins}" includes="**/*"/>
<fileset file="${bin}" includes="**/*"/>
</copy>
<copy todir="${sparkplugs.build}">
<fileset file="${targetdocs}/plugin_development_guide.html"/>
<fileset file="${targetdocs}/style.css"/>
<fileset file="${targetdocs}/examples.jar"/>
</copy>
<copy todir="${sparkplugs.build}/images">
<fileset file="${target.build}/documentation/images/*.*"/>
</copy>
<copy todir="${sparkplugs.build}/api">
<fileset file="${target.build}/documentation/api/**"/>
</copy>
<copy todir="${sparkplugs.build}/builder">
<fileset file="${basedir}/build/builder/**"/>
</copy>
</target>
<!-- installers ============================================================================= -->
<target name="installer.install4j" depends="jar,windows.build.plugins"
description="build Install4J release executable and docs dirs for Windows">
<condition property="install4j.not.ok" value="true">
<not>
<available file="${installer.install4j.home}/bin/install4j.jar"/>
</not>
</condition>
<fail if="install4j.not.ok"
message="Path to Install4j not set, see build.properties.template file."/>
<taskdef name="install4j"
classname="com.install4j.Install4JTask"
classpath="${installer.install4j.home}/bin/ant.jar"/>
<mkdir dir="${installer.dest.dir}"/>
<!-- Install4j doesn't support extra version info (like beta) correctly, so
define a special revision number. -->
<if>
<equals arg1="${version.extra}" arg2=""/>
<then>
<property name="install4j.revision" value="${version.revision}"/>
</then>
<else>
<property name="install4j.revision" value="${version.revision}.${version.extra}"/>
</else>
</if>
<install4j projectfile="${installer.install4j.srcfile}" destination="${installer.dest.dir}">
<variable name="VERSION_MAJOR" value="${version.major}"/>
<variable name="VERSION_MINOR" value="${version.minor}"/>
<variable name="VERSION_REVISION" value="${install4j.revision}"/>
<variable name="APP_NAME" value="${installer.app_name}"/>
<variable name="APP_SHORT_NAME" value="${installer.app_short_name}"/>
<variable name="PRODUCT_NAME" value="${installer.product_name}"/>
<variable name="PUBLISHER" value="${installer.publisher}"/>
<variable name="PUBLISHER_URL" value="${installer.publisher_url}"/>
<variable name="FILE_PREFIX" value="${installer.app_short_name}"/>
<variable name="RELEASE_ROOT_PATH" value="${installer.release_root_path}"/>
</install4j>
</target>
<target name="installer.advinst" depends="exe">
<condition property="advinst.not.ok" value="true">
<not>
<available file="${advinst.path}\AdvancedInstaller.com"/>
</not>
</condition>
<fail if="advinst.not.ok"
message="Path to Advanced Installer not set, or not installed."/>
<copy file="build\installer\spark.aip.tmpl" tofile="build\installer\spark.aip" />
<mkdir dir="${installer.dest.dir}"/>
<echo message="${win.msi.nojre}" />
<exec executable="${advinst.path}\AdvancedInstaller.com"
failonerror="true">
<arg line="/edit build\installer\spark.aip"/>
<arg line="/SetVersion ${version}"/>
</exec>
<exec executable="${advinst.path}\AdvancedInstaller.com"
failonerror="true">
<arg line="/edit build\installer\spark.aip"/>
<arg line="/SetPackageName '${win.msi.withjre}' -withjre"/>
</exec>
<exec executable="${advinst.path}\AdvancedInstaller.com"
failonerror="true">
<arg line="/edit build\installer\spark.aip"/>
<arg line="/SetPackageName '${win.msi.nojre}' -buildname DefaultBuild"/>
</exec>
<exec executable="${advinst.path}\AdvancedInstaller.com"
failonerror="true">
<arg line="/build build\installer\spark.aip"/>
</exec>
</target>
<target name="mac.clean">
<echo message="${mac.build.dir}" />
<exec dir="." executable="/bin/unlink" os="Mac OS X">
<arg value="${mac.build.dir}/Applications" />
</exec>
<delete file="${target}/tmp.dmg" />
<delete file="${mac.dmg.file}" />
<delete dir="${target}/jre" />
</target>
<target name="mac.build.plugin" depends="jar,build.plugins">
<!-- build the apple jar and place it in the plugins -->
<ant antfile="${basedir}/src/plugins/apple/build.xml" inheritall="no" target="clean"/>
<ant antfile="${basedir}/src/plugins/apple/build.xml" inheritall="no" target="jar"/>
<!-- build the growl jar and place it in the plugins -->
<ant antfile="${basedir}/src/plugins/growl/build.xml" inheritall="no" target="clean"/>
<ant antfile="${basedir}/src/plugins/growl/build.xml" inheritall="no" target="jar"/>
</target>
<target name="mac.app.zip" depends="mac.app">
<exec executable="/bin/bash" dir="${basedir}/build/installer/" failonerror="true">
<arg value="mac/tar.sh"/>
<arg value="${mac.build.dir}"/>
</exec>
</target>
<target name="mac.app" depends="mac.clean,mac.build.plugin">
<!-- https://bitbucket.org/infinitekind/appbundler
fork of java appbundler./ -->
<taskdef name="appbundler"
classpath="${basedir}/build/lib/appbundler-1.0ea.jar"
classname="com.oracle.appbundler.AppBundlerTask"/>
<mkdir dir="${mac.build.dir}"/>
<mkdir dir="${target}/jre"/>
<untar dest="${target}/jre" compression="gzip">
<cutdirsmapper dirs="1" />
<fileset dir="${mac.jre.localdir}">
<include name="**/jre*macosx-x64.tar.gz"/>
</fileset>
</untar>
<path id="osx.lib">
<fileset dir="${target.build}/lib">
<include name="**/*.jar"/>
<include name="**/*.jnilib"/>
<exclude name="**/windows/"/>
<exclude name="**/linux/"/>
</fileset>
<fileset dir="${target.build}/lib/windows">
<include name="jdic.jar"/>
</fileset>
<fileset dir="${basedir}/build/lib">
<include name="i4jruntime.jar"/>
</fileset>
</path>
<appbundler outputdirectory="${mac.build.dir}"
classpathref="osx.lib"
name="Spark"
displayname="Spark"
mainclassname="org.jivesoftware.launcher.Startup"
icon="${target}/classes/images/message.icns"
shortversion="${version.major}.${version.minor}.${version.revision}"
version="${version.extra}"
copyright="Ignite Realtime"
executablename="SparkLauncher"
identifier="com.jivesoftware.SparkBundle"
jvmrequired="1.8"
jrepreferred="true">
<arch name="x86_64"/>
<runtime dir="${target}/jre/Contents/Home"/>
<option value="-Djava.library.path=$APP_ROOT/Contents/Java/"/>
<option value="-Dappdir=$APP_ROOT/Contents/Resources"/>
<option value="-Xdock:name=Spark"/>
</appbundler>
<copy todir="${mac.app.file}/Contents/Resources">
<fileset dir="${target.build}">
<exclude name="**/lib/"/>
<exclude name="**/jniwrap.*"/>
<exclude name="**/jniwrapper.*"/>
<exclude name="**/idlelinux.*"/>
</fileset>
</copy>
<delete file="${plugins}/jniwrapper.jar"/>
</target>
<target name="installer.mac" depends="mac.app" description="build release dmg file for the Macintosh">
<fileset file="*.dmg"/>
<mkdir dir="${installer.dest.dir}"/>
<mkdir dir="${basedir}/installer"/>
<mkdir dir="${mac.build.dir}/.background"/>
<copy todir="${mac.build.dir}/.background">
<fileset file="${basedir}/build/installer/images/mac/dmgBackground.png"/>
</copy>
<symlink link="${mac.build.dir}/Applications" overwrite="true" resource="/Applications" />
<echo message="Create tmp.dmg"/>
<exec executable="hdiutil" failonerror="true">
<arg line="create -srcfolder '${mac.build.dir}' -volname '${mac.volname}' -fs HFS+ -fsargs '-c c=64,a=16,e=16' -format UDRW '${target}/tmp.dmg'"/>
</exec>
<echo message="Attach tmp.dmg"/>
<exec executable="hdiutil" failonerror="true">
<arg line="attach '${target}/tmp.dmg' -readwrite -noverify -noautoopen -noidme -mountpoint '${target}/tmp'"/>
</exec>
<!-- SPARK-1091 commented out since it wasn't working with Bamboo remote agent // TODO: fix it
<exec executable="cp">
<arg line="${basedir}/build/installer/mac/RightDSStore ${basedir}/build/tmp/.DS_Store"/>
</exec>
<exec executable="osascript" dir="${basedir}/build/installer/" failonerror="true">
<arg value="mac/dmg_spark.scpt"/>
<arg value="${mac.volname}"/>
<arg value="images/mac/background/"/>
<arg value="648"/>
<arg value="450"/>
<arg value="200"/>
<arg value="205"/>
<arg value="430"/>
<arg value="205"/>
<arg value="80"/>
</exec> -->
<echo message="detach tmp"/>
<exec executable="hdiutil" failonerror="true">
<arg line="detach ${target}/tmp -quiet -force"/>
</exec>
<echo message="convert tmp"/>
<exec executable="hdiutil" failonerror="true">
<arg line="convert ${target}/tmp.dmg -format UDZO -imagekey zlib-level=9 -o ${mac.dmg.file}"/>
</exec>
<echo message="internet-enable tmp"/>
<exec executable="hdiutil" failonerror="true">
<arg line="internet-enable -yes ${mac.dmg.file}"/>
</exec>
<echo message="delete tmp"/>
<delete file="${target}/tmp.dmg"/>
<!-- <symlink action="delete" failonerror="true" link="${mac.build.dir}/Applications"/> -->
</target>
<!-- Debian package ========================================================================= -->
<property name="work.dir" value="${basedir}/work"/>
<property name="debian.dir" value="${basedir}/build/debian"/>
<property name="debian.version" value="${version.major}.${version.minor}.${version.revision}"/>
<property name="debian.work.dir" value="${work.dir}/debian/spark-${debian.version}"/>
<property name="debian.release.dir" value="${basedir}/installer"/>
<tstamp>
<format property="debian.builddate" pattern="EEE, dd MMM yyyy HH:mm:ss Z" locale="en"/>
</tstamp>
<target name="installer.debian" depends="" description="build release deb file for the Debian,Ubuntu">
<copy todir="${debian.work.dir}/debian">
<fileset dir="${debian.dir}/" includes="**/*"/>
<filterset>
<filter token="builddate" value="${debian.builddate}"/>
<filter token="version" value="${debian.version}"/>
</filterset>
</copy>
<copy todir="${debian.work.dir}/documentation/">
<fileset dir="${basedir}/documentation/" includes="**/*"/>
</copy>
<copy todir="${debian.work.dir}/src/">
<fileset dir="${basedir}/src/" includes="**/*"/>
</copy>
<copy todir="${debian.work.dir}/build/">
<fileset dir="${basedir}/build/" includes="**/*"/>
</copy>
<chmod file="${debian.work.dir}/debian/rules" perm="755"/>
<exec executable="dpkg-buildpackage" dir="${debian.work.dir}" failonerror="false">
<arg line="-d"/>
</exec>
<mkdir dir="${debian.release.dir}"/>
<copy todir="${debian.release.dir}">
<fileset dir="${debian.work.dir}/.." followsymlinks="false">
<include name="**/*.deb"/>
<include name="**/*.changes"/>
<include name="**/*.dsc"/>
<include name="**/*.gz"/>
</fileset>
</copy>
</target>
<!-- IzPack package ========================================================================= -->
<target name="installer.izpack" depends="exe" description="build release a izpack installer">
<mkdir dir="${basedir}/installer/" />
<taskdef name="IzPack"
classpath="${installer.izpack.dir}/lib/standalone-compiler.jar"
classname="com.izforge.izpack.ant.IzPackTask"/>
<IzPack input="${basedir}/build/installer/spark-izpack.xml" output="${basedir}/installer/spark-installer.jar"
installerType="standard" izPackDir="${installer.izpack.dir}" basedir="${basedir}"/>
</target>
<!-- IzPack5 package ========================================================================= -->
<target name="installer.izpack5" depends="exe" description="build release an izpack5 installer">
<mkdir dir="${basedir}/installer/" />
<path id="build.classpath">
<fileset dir="${installer.izpack.dir}">
<include name="lib/*.jar" />
</fileset>
</path>
<taskdef name="IzPack"
classpathref="build.classpath"
classname="com.izforge.izpack.ant.IzPackTask"/>
<IzPack input="${basedir}/build/installer/spark-izpack5.xml"
output="${basedir}/installer/spark-installer.jar"
installerType="standard"
inheritAll="true"
izPackDir="${installer.izpack.dir}"
basedir="${basedir}" />
</target>
<!-- IzPack exe package ===================================================================== -->
<target name="installer.izpack.exe" depends="installer.izpack" description="build release executable izpack installer">
<exec executable="python" failonerror="true">
<arg line="${installer.izpack.dir}/utils/wrappers/izpack2exe/izpack2exe.py"/>
<arg line="--file=${basedir}/installer/spark-installer.jar"/>
<arg line="--output=${basedir}/installer/spark-installer.exe"/>
<arg line="--no-upx"/>
</exec>
</target>
<!-- installer.innosetup ========================================================================= -->
<target name="installer.innosetup" depends="exe" description="build release a izpack installer">
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />
<copy file="${basedir}/build/installer/izpack/launch4j.tmpl" tofile="${basedir}/build/installer/izpack/launch4j.xml" />
<copy file="${basedir}/build/installer/izpack/launch4j-starter.tmpl" tofile="${basedir}/build/installer/izpack/launch4j-starter.xml" />
<replace file="${basedir}/build/installer/izpack/launch4j.xml" token="@SPARKDIR@" value="${basedir}/target/build/" />
<replace file="${basedir}/build/installer/izpack/launch4j-starter.xml" token="@SPARKDIR@" value="${basedir}/target/build/" />
<launch4j configFile="${basedir}/build/installer/izpack/launch4j.xml" tmpdir="${temp.dir}" />
<launch4j configFile="${basedir}/build/installer/izpack/launch4j-starter.xml" tmpdir="${temp.dir}" />
<exec executable="${innosetup.dir}/ISCC.exe" failonerror="true">
<arg line="/Oinstaller"/>
<arg line="/Fspark-setup-iss.exe"/>
<arg line="build/installer/spark.iss"/>
</exec>
</target>
<!-- dist.src =============================================================================== -->
<property name="release.src.out.dir" value="target/src/Spark-${version}" />
<property name="release.fullname.src" value="spark_src_${version}"/>
<target name="dist.src" depends="release.javadocs" description="Creates a source distribution package">
<mkdir dir="${release.dir}"/>
<!-- Copy non-java source -->
<copy todir="${release.src.out.dir}/src">
<fileset dir="${basedir}/src/" excludes="**/*.java"/>
</copy>
<!-- Copy java source -->
<copy todir="${release.src.out.dir}/src">
<fileset dir="${basedir}/src/">
<include name="**/*.java" />
</fileset>
<filterset>
<filter token="DATE" value="${builddate}"/>
</filterset>
</copy>
<!-- Copy documentation -->
<copy todir="${release.src.out.dir}/documentation">
<fileset dir="${basedir}/target/build/documentation/"/>
</copy>
<!-- Copy build -->
<copy todir="${release.src.out.dir}/build">
<fileset dir="${basedir}/build"/>
</copy>
<!-- Source Packages -->
<zip zipfile="${release.dir}/${release.fullname.src}.zip"
basedir="${release.src.out.dir}/.."
includes="**/*"
/>
<tar tarfile="${release.dir}/${release.fullname.src}.tar.gz"
basedir="${release.src.out.dir}/.."
includes="**/*"
compression="gzip"
longfile="gnu"
/>
</target>
<!-- installer.rpm ========================================================================= -->
<property name="bundle.jre" value="false" />
<property name="target.work.subdir" value="rpm" />
<property name="target.rpm" value="${work.dir}/${target.work.subdir}" />
<property name="rpm.spec.file" value="${basedir}/build/rpm/spark.spec"/>
<tstamp>
<format property="rpm.builddate" pattern="EEE MMM dd yyyy" locale="en"/>
</tstamp>
<target name="installer.rpm" depends="dist.src,build.plugins" description="Builds a rpm of spark.">
<mkdir dir="${target.rpm}/SPECS" />
<mkdir dir="${target.rpm}/SOURCES" />
<mkdir dir="${target.rpm}/BUILD" />
<mkdir dir="${target.rpm}/SRPMS" />
<mkdir dir="${target.rpm}/RPMS" />
<copy tofile="${target.rpm}/SPECS/spark.spec" file="${rpm.spec.file}" />
<if>
<equals arg1="${bundle.jre}" arg2="true"/>
<then>
<!-- Include bundled jre -->
<copy todir="${target.rpm}/SOURCES" file="${basedir}/build/rpm/jre-dist.tar.gz" />
</then>
</if>
<copy todir="${target.rpm}/SOURCES" file="${release.dir}/${release.fullname.src}.tar.gz" />
<rpm specFile="spark.spec"
topDir="${target.rpm}"
command="-ba --define 'SPARK_VERSION ${version}' --define 'SPARK_SOURCE ${release.fullname.src}.tar.gz'"
failOnError="true"
/>
<copy todir="${release.dir}" >
<fileset dir="${target.rpm}/SRPMS" />
<fileset dir="${target.rpm}/" >
<include name="**/*.rpm"/>
</fileset>
</copy>
</target>
<!-- checkcode.pmd ========================================================================= -->
<target name="checkcode.pmd" description="Checkcode with pmd.">
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
<classpath>
<pathelement location="${basedir}/build/lib/pmd.jar" />
<pathelement location="${basedir}/build/lib/asm.jar" />
<pathelement location="${basedir}/build/lib/merge/jaxen.jar" />
</classpath>
</taskdef>
<pmd shortFilenames="true">
<ruleset>migrating</ruleset>
<ruleset>sunsecure</ruleset>
<ruleset>imports</ruleset>
<ruleset>strings</ruleset>
<formatter type="xml" toFile="target/pmd_report.xml" />
<formatter type="html" toFile="target/pmd_report.html" />
<fileset dir="src/">
<include name="**/*.java" />
</fileset>
</pmd>
</target>
<!-- checkcode.checkstyle ============================================================ -->
<target name="checkcode.checkstyle" description="Checkcode with checkstyle.">
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" classpath="build/lib/checkstyle.jar"/>
<checkstyle maxErrors="17000" config="build/checkstyle.xml">
<fileset dir="src/java" includes="**/*.java" />
<!-- <formatter type="plain"/> -->
<formatter type="xml" toFile="target/checkstyle.xml"/>
</checkstyle>
</target>
<!-- docbook ========================================================================= -->
<target name="docbook" description="Docbook">
<mkdir dir="${target}/docbook"/>
<exec executable="xmllint">
<arg value="--xinclude" />
<arg value="--output" />
<arg value="${target}/docbook/BOOK-MULTILANGUAGE.sgml" />
<arg value="src/docbook/book.sgml" />
</exec>
<xslt
in="${target}/docbook/BOOK-MULTILANGUAGE.sgml"
out="${target}/docbook/BOOK-DE.sgml"
style="build/docbook/filter_language.xsl"
force="yes"
>
<param name="language" expression="de"/>
<outputproperty name="encoding" value="iso8859_1"/>
</xslt>
<xslt
in="${target}/docbook/BOOK-MULTILANGUAGE.sgml"
out="${target}/docbook/BOOK-EN.sgml"
style="build/docbook/filter_language.xsl"
force="yes"
>
<param name="language" expression="en"/>
</xslt>
<exec executable="docbook2pdf">
<arg value="${target}/docbook/BOOK-DE.sgml" />
<arg value="--output" />
<arg value="${release.dir}" />
</exec>
<exec executable="docbook2pdf">
<arg value="${target}/docbook/BOOK-EN.sgml" />
<arg value="--output" />
<arg value="${release.dir}" />
</exec>
</target>
<target name="proxy" depends="probe-proxy" if="proxy.enabled">
<echo>${proxy.host} ${proxy.port} ${proxy.user} ${proxy.pass} </echo>
<setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"
proxyuser="${proxy.user}" proxypassword="${proxy.pass}"/>
</target>
<target name="probe-proxy">
<condition property="proxy.enabled">
<and>
<isset property="proxy.host"/>
<isreachable host="${proxy.host}"/>
</and>
</condition>
</target>
<!-- END docbook ===================================================================== -->
</project>