Commit ab480a24 authored by Guus der Kinderen's avatar Guus der Kinderen

Merge pull request #268 from guusdk/OF-930

OF-930 & OF-935 Fixes
parents 9c8d8887 fdd5bcfe
......@@ -121,18 +121,58 @@
<!-- For auto-running and debugging -->
<property name="debug" value="false"/>
<!-- ======================================================================================= -->
<!-- PATHs / PATTERNSETs / FILTERSETs -->
<!-- ======================================================================================= -->
<path id="ant.dependencies">
<fileset dir="${lib.ant.dir}" includes="*.jar" />
<fileset dir="${ant.home}/lib" includes="ant.jar" />
</path>
<!-- ======================================================================================= -->
<!-- GLOBAL TASKDEFs -->
<!-- ======================================================================================= -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath refid="ant.dependencies" />
</taskdef>
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
<classpath refid="ant.dependencies" />
</taskdef>
<typedef name="srcinc" classname="com.jivesoftware.tools.selector.IncludeSourceSelector" >
<classpath refid="ant.dependencies" />
</typedef>
<!-- ======================================================================================= -->
<!-- PATHs / PATTERNSETs / FILTERSETs -->
<!-- ======================================================================================= -->
<available type="dir" file="${overlay.dir}" property="overlay.dir.found"/>
<available type="dir" file="${overlay.src.dir}" property="overlay.src.dir.found"/>
<available type="dir" file="${overlay.web.dir}" property="overlay.web.dir.found"/>
<available type="dir" file="${overlay.lib.dir}" property="overlay.lib.dir.found"/>
<available type="dir" file="${overlay.conf.dir}" property="overlay.conf.dir.found"/>
<available type="file" file="${overlay.properties.file}" property="overlay.properties.file.found"/>
<!-- When overlay is used the content of "lib.merge.dir" needs to be combined with the content of "overlay.lib.dir"
Here, "libs.to.merge" is created which will always refer to the correct combination. "libs.to.merge" should be
used instead of "lib.merge.dir" and/or "overlay.lib.dir" from this point onwards.
-->
<if>
<equals arg1="${overlay.lib.dir.found}" arg2="true"/>
<then>
<path id="libs.to.merge">
<fileset dir="${lib.merge.dir}" includes="**/*.jar"/>
<fileset dir="${overlay.lib.dir}" includes="**/*.jar"/>
</path>
</then>
<else>
<path id="libs.to.merge">
<fileset dir="${lib.merge.dir}" includes="**/*.jar"/>
</path>
</else>
</if>
<path id="javadoc.dependencies">
<fileset dir="${lib.build.dir}" includes="*.jar" excludes="junit.jar"/>
<fileset dir="${lib.merge.dir}" includes="*.jar"/>
<path refid="libs.to.merge" />
<fileset dir="${lib.dist.dir}" includes="servlet-api.jar, servlet-api-schemas.jar, mail.jar, jdic.jar"/>
<fileset dir="${lib.dist.dir}" includes="bcpg-jdk15on.jar, bcpkix-jdk15on.jar, bcprov-jdk15on.jar"/>
</path>
......@@ -148,13 +188,9 @@
<fileset dir="${lib.web.dir}" includes="*.jar"/>
</path>
<path id="custom.dependencies">
<fileset dir="${overlay.lib.dir}" includes="*.jar"/>
</path>
<path id="test.dependencies">
<path refid="compile.dependencies"/>
<fileset dir="${jar.dest.dir}" includes="openfire.jar"/>
<fileset dir="${jar.dest.dir}" includes="${jar.name}"/>
<fileset dir="${lib.build.dir}" includes="junit.jar"/>
<fileset dir="${lib.build.dir}" includes="hamcrest-core.jar"/>
<fileset dir="${lib.dist.dir}" includes="slf4j-log4j12.jar"/>
......@@ -163,7 +199,7 @@
<path id="plugin.dependencies">
<path refid="javadoc.dependencies"/>
<fileset dir="${jar.dest.dir}" includes="openfire.jar"/>
<fileset dir="${jar.dest.dir}" includes="${jar.name}"/>
</path>
<patternset id="compile.sources">
......@@ -187,22 +223,9 @@
<include name="**/*.js"/>
</patternset>
<presetdef name="of.javac">
<javac encoding="utf8" source="${javac.source}" target="${javac.target}" includeAntRuntime="no" debug="on"/>
</presetdef>
<!-- ======================================================================================= -->
<!-- GLOBAL TASKDEFs -->
<!-- ======================================================================================= -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath refid="ant.dependencies" />
</taskdef>
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
<classpath refid="ant.dependencies" />
</taskdef>
<typedef name="srcinc" classname="com.jivesoftware.tools.selector.IncludeSourceSelector" >
<classpath refid="ant.dependencies" />
</typedef>
<presetdef name="of.javac">
<javac encoding="utf8" source="${javac.source}" target="${javac.target}" includeAntRuntime="no" debug="on"/>
</presetdef>
<!-- ======================================================================================= -->
<!-- TARGETs -->
......@@ -243,7 +266,6 @@
</tstamp>
<mkdir dir="${work.dir}"/>
<mkdir dir="${overlay.compile.dir}"/>
<!-- Setup the full version property correctly -->
<if>
......@@ -265,44 +287,38 @@
<!-- compile =============================================================================== -->
<target name="compile" depends="init" description="Compiles Openfire app code">
<mkdir dir="${compile.dir}"/>
<of.javac destdir="${compile.dir}">
<src path="${src.java.dir}"/>
<patternset refid="compile.sources"/>
<classpath>
<path refid="compile.dependencies"/>
</classpath>
<classpath refid="compile.dependencies"/>
</of.javac>
<available file="${overlay.lib.dir}" type="dir" property="overlay.lib.found"/>
<if>
<equals arg1="${overlay.lib.found}" arg2="true"/>
<then>
<mkdir dir="${jar.dest.dir}"/>
<copy todir="${jar.dest.dir}" overwrite="true">
<fileset dir="${overlay.lib.dir}" includes="*.*"/>
</copy>
</then>
<else><echo>No custom lib here </echo></else>
</if>
<available file="${overlay.src.dir}" type="dir" property="overlay.source.found"/>
<!-- The Ant 'javac' tasks does not allow one to use more than one source directory and simultaneously exclude
duplicates from one. As a work-around, the overlay-sources are compiled in a second iteration, overwriting
any compiled files from the first iteration.
-->
<if>
<equals arg1="${overlay.source.found}" arg2="true"/>
<equals arg1="${overlay.src.dir.found}" arg2="true"/>
<then>
<mkdir dir="${overlay.compile.dir}"/>
<of.javac destdir="${overlay.compile.dir}">
<src path="${overlay.src.dir}"/>
<patternset refid="compile.sources"/>
<classpath>
<path refid="custom.dependencies"/>
<path refid="compile.dependencies"/>
<path location="${compile.dir}"/>
<path refid="compile.dependencies"/>
</classpath>
</of.javac>
<!-- By copying/overwriting overlays directly into compile.dir, all tasks executed after this one need
not consider both compile.dir and overlay.compile.dir (which simplifies further tasks considerably).
-->
<copy todir="${compile.dir}" overwrite="true">
<fileset dir="${overlay.compile.dir}"/>
</copy>
</then>
<else><echo>Nothing to compile from custom here </echo></else>
</if>
</target>
......@@ -315,18 +331,15 @@
tofile="${target.i18n.dir}/${i18n.basename}.properties"/>
<!-- if title override file exists, overwrite all i18n files -->
<available file="${overlay.dir}/${overlay.properties.file}" type="file" property="overlay.props.found"/>
<if>
<equals arg1="${overlay.props.found}" arg2="true"/>
<then>
<echo>Found overlay file: ${overlay.dir}/${overlay.properties.file}</echo>
<property file="${overlay.dir}/${overlay.properties.file}"/>
<replace dir="${target.i18n.dir}">
<replacefilter token="title = Wildfire" value="title=${title}"/>
<replacefilter token="short.title = Wildfire" value="short.title=${short.title}"/>
</replace>
</then>
<equals arg1="${overlay.properties.file.found}" arg2="true"/>
<then>
<property file="${overlay.properties.file}"/>
<replace dir="${target.i18n.dir}">
<replacefilter token="title = Wildfire" value="title=${title}"/>
<replacefilter token="short.title = Wildfire" value="short.title=${short.title}"/>
</replace>
</then>
</if>
</target>
......@@ -372,17 +385,15 @@
<mkdir dir="${jar.dest.dir}"/>
<!-- Make main Openfire jar -->
<jar jarfile="${jar.dest.dir}/${jar.name}" index="true" duplicate="preserve">
<fileset dir="${compile.dir}" includes="**/*.class"
excludes="org/jivesoftware/openfire/starter/ServerStarter*.class,org/jivesoftware/openfire/launcher/*.class">
<!-- don't include files that have an overlay counterpart -->
<present present="srconly" targetdir="${overlay.compile.dir}"/>
</fileset>
<!-- now include overlay files -->
<fileset dir="${overlay.compile.dir}" includes="**/*.class"/>
<fileset dir="${compile.dir}" includes="**/*.class" excludes="org/jivesoftware/openfire/starter/ServerStarter*.class,org/jivesoftware/openfire/launcher/*.class"/>
<fileset dir="${src.i18n.dir}" includes="*.properties"/>
<fileset dir="${target.i18n.dir}" includes="*.properties"/>
<fileset dir="${resources.dir}/jar" includes="**"/>
<zipgroupfileset dir="${lib.merge.dir}" includes="*.jar"/>
<archives>
<zips>
<path refid="libs.to.merge"/>
</zips>
</archives>
<manifest>
<attribute name="Built-By" value="Jive Software (www.igniterealtime.org)"/>
</manifest>
......@@ -508,28 +519,30 @@
<antcall target="-jspc-impl"/>
</target>
<target name="-jspc-impl" unless="no.jspc">
<!-- we're forced to create a temp dir to properly overwrite sources from overlay directory -->
<!-- In a different approach to 'overlay' as compared with the 'compile' task, this task first creates a new
directory that combines of the original files, overwritten by the 'overlay' files before processing
occurs. This approach is simpler, but requires quite some disk operations (and is therefor not used in the
'compile' task).
-->
<mkdir dir="${jspc.jsp.src.dir}"/>
<copy todir="${jspc.jsp.src.dir}">
<fileset dir="${web.dir}"/>
<fileset dir="${web.dir}" includes="**/*"/>
</copy>
<!-- copy overlay -->
<available file="${overlay.web.dir}" type="dir" property="overlay.webdir.found"/>
<if>
<equals arg1="${overlay.webdir.found}" arg2="true"/>
<equals arg1="${overlay.web.dir.found}" arg2="true"/>
<then>
<copy todir="${jspc.jsp.src.dir}" overwrite="true">
<fileset dir="${overlay.web.dir}"/>
<fileset dir="${overlay.web.dir}" includes="**/*"/>
</copy>
</then>
</if>
<!-- Generate .java files from the .jsp files. -->
<java classname="org.apache.jasper.JspC" fork="true">
<classpath>
<pathelement location="${java.home}/../lib/tools.jar"/>
......@@ -542,7 +555,7 @@
<arg line="-webinc '${jspc.dest.dir}/web.partial.xml'"/>
</java>
<!-- Compile java source -->
<!-- Compile the .java files-->
<of.javac destdir="${jspc.classes.dest.dir}">
<include name="org/jivesoftware/openfire/admin/**/*.java"/>
<src path="${jspc.java.dest.dir}"/>
......@@ -636,12 +649,11 @@
<fileset dir="${src.dir}" includes="conf/**/*.*"></fileset>
</copy>
<available file="${overlay.conf.dir}" type="dir" property="overlay.conf.found"/>
<if>
<equals arg1="${overlay.conf.found}" arg2="true"/>
<equals arg1="${overlay.conf.dir.found}" arg2="true"/>
<then>
<copy todir="${target.openfireHome}" overwrite="true">
<fileset dir="${overlay.dir}" includes="conf/**/*.*"/>
<fileset dir="${overlay.conf.dir}" includes="**/*"/>
</copy>
</then>
<else><echo>No custom config here </echo></else>
......@@ -744,6 +756,22 @@
<exclude name="**/*.jspf"/>
</fileset>
</copy>
<!-- Copy admin plugin overlay resources -->
<if>
<equals arg1="${overlay.web.dir.found}" arg2="true"/>
<then>
<copy todir="${plugin.dest.dir}/admin/webapp" overwrite="true">
<!-- All web resources minus jsp's and jspf's - those are precompiled -->
<fileset dir="${overlay.web.dir}">
<patternset refid="web.sources"/>
<exclude name="**/*.jsp"/>
<exclude name="**/*.jspf"/>
</fileset>
</copy>
</then>
</if>
<!-- Copy other admin WEB-INF stuff -->
<copy todir="${plugin.dest.dir}/admin/webapp">
<fileset dir="${webapp.dest.dir}"/>
......@@ -1213,26 +1241,26 @@
<mkdir dir="${plugin.dest.dir}"/>
<!-- Get a list of subdirs of the main plugins dir. This tells us which plugins to make. -->
<subdirinfo dir="${plugin.src.dir}" property="dirlist" ifexists="plugin.xml"
except="admin"/>
<!-- Get a list of subdirs of the main plugins dir. This tells us which plugins to make. Exclude the
admin plugin (which is created by a different Ant task) as well as the clustering plugin (which
requires non-free JAR-files to be added to its library path, which most users won't do). -->
<subdirinfo dir="${plugin.src.dir}" property="dirlist" ifexists="plugin.xml" except="admin,clustering"/>
<antcall target="-plugins-impl-dev"/>
<antcall target="-plugins-impl"/>
<!-- Update/create target/openfire directory -->
<antcall target="openfireHome"/>
</target>
<target name="-plugins-impl" if="dirlist">
<!-- For each plugin in the main src dir, call the 'buildplugin' macro -->
<!-- First, do all plugins that do not have a parent plugin (some of them could be parents of others) -->
<for list="${dirlist}" param="plugin" trim="true">
<sequential>
<xmlproperty file="${plugin.src.dir}/@{plugin}/plugin.xml" keeproot="true"/>
<if>
<equals arg1="@{plugin}" arg2="clustering"/>
<isset property="plugin.parentPlugin"/>
<then>
<echo message="bypassing clustering plugin, build via single plugin target if needed"/>
</then>
<else>
<buildplugin plugin="@{plugin}" pluginsrc="${plugin.src.dir}"/>
......@@ -1241,33 +1269,21 @@
</sequential>
</for>
</target>
<target name="-plugins-impl-dev" if="plugin.dev.dir" depends="anttasks">
<!-- Get a list of plugins in the optional dev dir -->
<subdirinfo dir="${plugin.dev.dir}" property="dirlist2" ifexists="plugin.xml"/>
<antcall target="-plugin-impl-dev-build"/>
</target>
<target name="-plugin-impl-dev-build" if="dirlist2">
<!-- For each list of plugins in the dev dir call the 'buildplugin' macro -->
<for list="${dirlist2}" param="plugin" trim="true">
<!-- Lastly, do all plugins that have defined a parent plugin. This works, as long as there are no 'chains' -->
<for list="${dirlist}" param="plugin" trim="true">
<sequential>
<xmlproperty file="${plugin.src.dir}/@{plugin}/plugin.xml" keeproot="true"/>
<if>
<equals arg1="@{plugin}" arg2="clustering"/>
<isset property="plugin.parentPlugin"/>
<then>
<echo message="bypassing clustering plugin, build via single plugin target if needed"/>
<buildplugin plugin="@{plugin}" pluginsrc="${plugin.src.dir}"/>
</then>
<else>
<buildplugin plugin="@{plugin}" pluginsrc="${plugin.dev.dir}"/>
</else>
</if>
</sequential>
</for>
</target>
<target name="plugin" description="build one plugin">
<mkdir dir="${plugin.dest.dir}"/>
......@@ -1294,15 +1310,32 @@
<mkdir dir="${plugin.dev.dest.dir}/@{plugin}"/>
<mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target"/>
<!-- Determine if this plugin has a parent plugin and if so, add it to the classpath. Note that it is
up to the caller to guarantee that a parent plugin has already been compiled!
-->
<xmlproperty file="${plugin.src.dir}/@{plugin}/plugin.xml" keeproot="true"/>
<if>
<isset property="plugin.parentPlugin"/>
<then>
<echo>Parent plugin found: ${plugin.parentPlugin}</echo>
<path id="plugin.classpath.source">
<path refid="plugin.dependencies"/>
<fileset dir="@{pluginsrc}/@{plugin}" includes="lib/*.jar"/>
<fileset dir="${plugin.dev.dest.dir}/${plugin.parentPlugin}/target/" includes="lib/*.jar"/>
</path>
</then>
<else>
<path id="plugin.classpath.source">
<path refid="plugin.dependencies"/>
<fileset dir="@{pluginsrc}/@{plugin}" includes="lib/*.jar"/>
</path>
</else>
</if>
<!-- Compile plugin source code -->
<mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/classes"/>
<of.javac destdir="${plugin.dev.dest.dir}/@{plugin}/target/classes">
<of.javac destdir="${plugin.dev.dest.dir}/@{plugin}/target/classes" classpathref="plugin.classpath.source">
<src path="@{pluginsrc}/@{plugin}/src/java"/>
<classpath>
<path refid="plugin.dependencies"/>
<!-- Jars used by the plugin to compile with -->
<fileset dir="@{pluginsrc}/@{plugin}" includes="lib/*.jar"/>
</classpath>
</of.javac>
<mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/lib" />
......@@ -1334,15 +1367,10 @@
<src path="@{pluginlib}/source"/>
<classpath>
<pathelement location="${plugin.dev.dest.dir}/@{plugin}/target/classes"/>
<path>
<path refid="plugin.dependencies"/>
<!-- Jars used by the plugin to compile with -->
<fileset dir="@{pluginsrc}/@{plugin}" includes="lib/*.jar"/>
</path>
<path refid="plugin.classpath.source"/>
</classpath>
</of.javac>
<jar jarfile="${plugin.dev.dest.dir}/@{plugin}/target/lib/@{plugin}-lib.jar">
<fileset dir="@{pluginlib}/classes" />
</jar>
......
......@@ -2,7 +2,7 @@
<html>
<head>
<title>Openfire: Database Installation Guide</title>
<title>Openfire: Customization Guide</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
......
......@@ -25,6 +25,9 @@ import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* A simple ant task to return the sub directories of a given dir as a comma delimited string.
......@@ -89,6 +92,12 @@ public class SubDirInfoTask extends Task {
public void execute() throws BuildException {
// Get the siblings of the given directory, add sub directory names to the property
List excepts;
if (except != null) {
excepts = Arrays.asList( except.split( getDelimiter() ) );
} else {
excepts = Collections.EMPTY_LIST;
}
File[] subdirs = dir.listFiles();
StringBuffer buf = new StringBuffer();
String value = null;
......@@ -108,7 +117,7 @@ public class SubDirInfoTask extends Task {
add = true;
}
}
if (add && !subdir.getName().equals(except)) {
if (add && !excepts.contains(subdir.getName())) {
buf.append(sep).append(subdir.getName());
sep = getDelimiter();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment