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 @@ ...@@ -121,18 +121,58 @@
<!-- For auto-running and debugging --> <!-- For auto-running and debugging -->
<property name="debug" value="false"/> <property name="debug" value="false"/>
<!-- ======================================================================================= -->
<!-- PATHs / PATTERNSETs / FILTERSETs -->
<!-- ======================================================================================= -->
<path id="ant.dependencies"> <path id="ant.dependencies">
<fileset dir="${lib.ant.dir}" includes="*.jar" /> <fileset dir="${lib.ant.dir}" includes="*.jar" />
<fileset dir="${ant.home}/lib" includes="ant.jar" /> <fileset dir="${ant.home}/lib" includes="ant.jar" />
</path> </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"> <path id="javadoc.dependencies">
<fileset dir="${lib.build.dir}" includes="*.jar" excludes="junit.jar"/> <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="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"/> <fileset dir="${lib.dist.dir}" includes="bcpg-jdk15on.jar, bcpkix-jdk15on.jar, bcprov-jdk15on.jar"/>
</path> </path>
...@@ -148,13 +188,9 @@ ...@@ -148,13 +188,9 @@
<fileset dir="${lib.web.dir}" includes="*.jar"/> <fileset dir="${lib.web.dir}" includes="*.jar"/>
</path> </path>
<path id="custom.dependencies">
<fileset dir="${overlay.lib.dir}" includes="*.jar"/>
</path>
<path id="test.dependencies"> <path id="test.dependencies">
<path refid="compile.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="junit.jar"/>
<fileset dir="${lib.build.dir}" includes="hamcrest-core.jar"/> <fileset dir="${lib.build.dir}" includes="hamcrest-core.jar"/>
<fileset dir="${lib.dist.dir}" includes="slf4j-log4j12.jar"/> <fileset dir="${lib.dist.dir}" includes="slf4j-log4j12.jar"/>
...@@ -163,7 +199,7 @@ ...@@ -163,7 +199,7 @@
<path id="plugin.dependencies"> <path id="plugin.dependencies">
<path refid="javadoc.dependencies"/> <path refid="javadoc.dependencies"/>
<fileset dir="${jar.dest.dir}" includes="openfire.jar"/> <fileset dir="${jar.dest.dir}" includes="${jar.name}"/>
</path> </path>
<patternset id="compile.sources"> <patternset id="compile.sources">
...@@ -187,22 +223,9 @@ ...@@ -187,22 +223,9 @@
<include name="**/*.js"/> <include name="**/*.js"/>
</patternset> </patternset>
<presetdef name="of.javac"> <presetdef name="of.javac">
<javac encoding="utf8" source="${javac.source}" target="${javac.target}" includeAntRuntime="no" debug="on"/> <javac encoding="utf8" source="${javac.source}" target="${javac.target}" includeAntRuntime="no" debug="on"/>
</presetdef> </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>
<!-- ======================================================================================= --> <!-- ======================================================================================= -->
<!-- TARGETs --> <!-- TARGETs -->
...@@ -243,7 +266,6 @@ ...@@ -243,7 +266,6 @@
</tstamp> </tstamp>
<mkdir dir="${work.dir}"/> <mkdir dir="${work.dir}"/>
<mkdir dir="${overlay.compile.dir}"/>
<!-- Setup the full version property correctly --> <!-- Setup the full version property correctly -->
<if> <if>
...@@ -265,44 +287,38 @@ ...@@ -265,44 +287,38 @@
<!-- compile =============================================================================== --> <!-- compile =============================================================================== -->
<target name="compile" depends="init" description="Compiles Openfire app code"> <target name="compile" depends="init" description="Compiles Openfire app code">
<mkdir dir="${compile.dir}"/> <mkdir dir="${compile.dir}"/>
<of.javac destdir="${compile.dir}"> <of.javac destdir="${compile.dir}">
<src path="${src.java.dir}"/> <src path="${src.java.dir}"/>
<patternset refid="compile.sources"/> <patternset refid="compile.sources"/>
<classpath> <classpath refid="compile.dependencies"/>
<path refid="compile.dependencies"/>
</classpath>
</of.javac> </of.javac>
<available file="${overlay.lib.dir}" type="dir" property="overlay.lib.found"/> <!-- The Ant 'javac' tasks does not allow one to use more than one source directory and simultaneously exclude
<if> duplicates from one. As a work-around, the overlay-sources are compiled in a second iteration, overwriting
<equals arg1="${overlay.lib.found}" arg2="true"/> any compiled files from the first iteration.
<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"/>
<if> <if>
<equals arg1="${overlay.source.found}" arg2="true"/> <equals arg1="${overlay.src.dir.found}" arg2="true"/>
<then> <then>
<mkdir dir="${overlay.compile.dir}"/> <mkdir dir="${overlay.compile.dir}"/>
<of.javac destdir="${overlay.compile.dir}"> <of.javac destdir="${overlay.compile.dir}">
<src path="${overlay.src.dir}"/> <src path="${overlay.src.dir}"/>
<patternset refid="compile.sources"/> <patternset refid="compile.sources"/>
<classpath> <classpath>
<path refid="custom.dependencies"/>
<path refid="compile.dependencies"/>
<path location="${compile.dir}"/> <path location="${compile.dir}"/>
<path refid="compile.dependencies"/>
</classpath> </classpath>
</of.javac> </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> </then>
<else><echo>Nothing to compile from custom here </echo></else>
</if> </if>
</target> </target>
...@@ -315,18 +331,15 @@ ...@@ -315,18 +331,15 @@
tofile="${target.i18n.dir}/${i18n.basename}.properties"/> tofile="${target.i18n.dir}/${i18n.basename}.properties"/>
<!-- if title override file exists, overwrite all i18n files --> <!-- if title override file exists, overwrite all i18n files -->
<available file="${overlay.dir}/${overlay.properties.file}" type="file" property="overlay.props.found"/>
<if> <if>
<equals arg1="${overlay.props.found}" arg2="true"/> <equals arg1="${overlay.properties.file.found}" arg2="true"/>
<then> <then>
<echo>Found overlay file: ${overlay.dir}/${overlay.properties.file}</echo> <property file="${overlay.properties.file}"/>
<property file="${overlay.dir}/${overlay.properties.file}"/> <replace dir="${target.i18n.dir}">
<replace dir="${target.i18n.dir}"> <replacefilter token="title = Wildfire" value="title=${title}"/>
<replacefilter token="title = Wildfire" value="title=${title}"/> <replacefilter token="short.title = Wildfire" value="short.title=${short.title}"/>
<replacefilter token="short.title = Wildfire" value="short.title=${short.title}"/> </replace>
</replace> </then>
</then>
</if> </if>
</target> </target>
...@@ -372,17 +385,15 @@ ...@@ -372,17 +385,15 @@
<mkdir dir="${jar.dest.dir}"/> <mkdir dir="${jar.dest.dir}"/>
<!-- Make main Openfire jar --> <!-- Make main Openfire jar -->
<jar jarfile="${jar.dest.dir}/${jar.name}" index="true" duplicate="preserve"> <jar jarfile="${jar.dest.dir}/${jar.name}" index="true" duplicate="preserve">
<fileset dir="${compile.dir}" includes="**/*.class" <fileset dir="${compile.dir}" includes="**/*.class" excludes="org/jivesoftware/openfire/starter/ServerStarter*.class,org/jivesoftware/openfire/launcher/*.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="${src.i18n.dir}" includes="*.properties"/> <fileset dir="${src.i18n.dir}" includes="*.properties"/>
<fileset dir="${target.i18n.dir}" includes="*.properties"/> <fileset dir="${target.i18n.dir}" includes="*.properties"/>
<fileset dir="${resources.dir}/jar" includes="**"/> <fileset dir="${resources.dir}/jar" includes="**"/>
<zipgroupfileset dir="${lib.merge.dir}" includes="*.jar"/> <archives>
<zips>
<path refid="libs.to.merge"/>
</zips>
</archives>
<manifest> <manifest>
<attribute name="Built-By" value="Jive Software (www.igniterealtime.org)"/> <attribute name="Built-By" value="Jive Software (www.igniterealtime.org)"/>
</manifest> </manifest>
...@@ -508,28 +519,30 @@ ...@@ -508,28 +519,30 @@
<antcall target="-jspc-impl"/> <antcall target="-jspc-impl"/>
</target> </target>
<target name="-jspc-impl" unless="no.jspc"> <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}"/> <mkdir dir="${jspc.jsp.src.dir}"/>
<copy todir="${jspc.jsp.src.dir}"> <copy todir="${jspc.jsp.src.dir}">
<fileset dir="${web.dir}"/> <fileset dir="${web.dir}" includes="**/*"/>
</copy> </copy>
<!-- copy overlay -->
<available file="${overlay.web.dir}" type="dir" property="overlay.webdir.found"/>
<if> <if>
<equals arg1="${overlay.webdir.found}" arg2="true"/> <equals arg1="${overlay.web.dir.found}" arg2="true"/>
<then> <then>
<copy todir="${jspc.jsp.src.dir}" overwrite="true"> <copy todir="${jspc.jsp.src.dir}" overwrite="true">
<fileset dir="${overlay.web.dir}"/> <fileset dir="${overlay.web.dir}" includes="**/*"/>
</copy> </copy>
</then> </then>
</if> </if>
<!-- Generate .java files from the .jsp files. -->
<java classname="org.apache.jasper.JspC" fork="true"> <java classname="org.apache.jasper.JspC" fork="true">
<classpath> <classpath>
<pathelement location="${java.home}/../lib/tools.jar"/> <pathelement location="${java.home}/../lib/tools.jar"/>
...@@ -542,7 +555,7 @@ ...@@ -542,7 +555,7 @@
<arg line="-webinc '${jspc.dest.dir}/web.partial.xml'"/> <arg line="-webinc '${jspc.dest.dir}/web.partial.xml'"/>
</java> </java>
<!-- Compile java source --> <!-- Compile the .java files-->
<of.javac destdir="${jspc.classes.dest.dir}"> <of.javac destdir="${jspc.classes.dest.dir}">
<include name="org/jivesoftware/openfire/admin/**/*.java"/> <include name="org/jivesoftware/openfire/admin/**/*.java"/>
<src path="${jspc.java.dest.dir}"/> <src path="${jspc.java.dest.dir}"/>
...@@ -636,12 +649,11 @@ ...@@ -636,12 +649,11 @@
<fileset dir="${src.dir}" includes="conf/**/*.*"></fileset> <fileset dir="${src.dir}" includes="conf/**/*.*"></fileset>
</copy> </copy>
<available file="${overlay.conf.dir}" type="dir" property="overlay.conf.found"/>
<if> <if>
<equals arg1="${overlay.conf.found}" arg2="true"/> <equals arg1="${overlay.conf.dir.found}" arg2="true"/>
<then> <then>
<copy todir="${target.openfireHome}" overwrite="true"> <copy todir="${target.openfireHome}" overwrite="true">
<fileset dir="${overlay.dir}" includes="conf/**/*.*"/> <fileset dir="${overlay.conf.dir}" includes="**/*"/>
</copy> </copy>
</then> </then>
<else><echo>No custom config here </echo></else> <else><echo>No custom config here </echo></else>
...@@ -744,6 +756,22 @@ ...@@ -744,6 +756,22 @@
<exclude name="**/*.jspf"/> <exclude name="**/*.jspf"/>
</fileset> </fileset>
</copy> </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 other admin WEB-INF stuff -->
<copy todir="${plugin.dest.dir}/admin/webapp"> <copy todir="${plugin.dest.dir}/admin/webapp">
<fileset dir="${webapp.dest.dir}"/> <fileset dir="${webapp.dest.dir}"/>
...@@ -1213,26 +1241,26 @@ ...@@ -1213,26 +1241,26 @@
<mkdir dir="${plugin.dest.dir}"/> <mkdir dir="${plugin.dest.dir}"/>
<!-- Get a list of subdirs of the main plugins dir. This tells us which plugins to make. --> <!-- Get a list of subdirs of the main plugins dir. This tells us which plugins to make. Exclude the
<subdirinfo dir="${plugin.src.dir}" property="dirlist" ifexists="plugin.xml" admin plugin (which is created by a different Ant task) as well as the clustering plugin (which
except="admin"/> 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"/> <antcall target="-plugins-impl"/>
<!-- Update/create target/openfire directory --> <!-- Update/create target/openfire directory -->
<antcall target="openfireHome"/> <antcall target="openfireHome"/>
</target> </target>
<target name="-plugins-impl" if="dirlist"> <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"> <for list="${dirlist}" param="plugin" trim="true">
<sequential> <sequential>
<xmlproperty file="${plugin.src.dir}/@{plugin}/plugin.xml" keeproot="true"/>
<if> <if>
<equals arg1="@{plugin}" arg2="clustering"/> <isset property="plugin.parentPlugin"/>
<then> <then>
<echo message="bypassing clustering plugin, build via single plugin target if needed"/>
</then> </then>
<else> <else>
<buildplugin plugin="@{plugin}" pluginsrc="${plugin.src.dir}"/> <buildplugin plugin="@{plugin}" pluginsrc="${plugin.src.dir}"/>
...@@ -1241,33 +1269,21 @@ ...@@ -1241,33 +1269,21 @@
</sequential> </sequential>
</for> </for>
</target> <!-- Lastly, do all plugins that have defined a parent plugin. This works, as long as there are no 'chains' -->
<target name="-plugins-impl-dev" if="plugin.dev.dir" depends="anttasks"> <for list="${dirlist}" param="plugin" trim="true">
<!-- 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">
<sequential> <sequential>
<xmlproperty file="${plugin.src.dir}/@{plugin}/plugin.xml" keeproot="true"/>
<if> <if>
<equals arg1="@{plugin}" arg2="clustering"/> <isset property="plugin.parentPlugin"/>
<then> <then>
<echo message="bypassing clustering plugin, build via single plugin target if needed"/> <buildplugin plugin="@{plugin}" pluginsrc="${plugin.src.dir}"/>
</then> </then>
<else>
<buildplugin plugin="@{plugin}" pluginsrc="${plugin.dev.dir}"/>
</else>
</if> </if>
</sequential> </sequential>
</for> </for>
</target> </target>
<target name="plugin" description="build one plugin"> <target name="plugin" description="build one plugin">
<mkdir dir="${plugin.dest.dir}"/> <mkdir dir="${plugin.dest.dir}"/>
...@@ -1294,15 +1310,32 @@ ...@@ -1294,15 +1310,32 @@
<mkdir dir="${plugin.dev.dest.dir}/@{plugin}"/> <mkdir dir="${plugin.dev.dest.dir}/@{plugin}"/>
<mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target"/> <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 --> <!-- Compile plugin source code -->
<mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/classes"/> <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"/> <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> </of.javac>
<mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/lib" /> <mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/lib" />
...@@ -1334,15 +1367,10 @@ ...@@ -1334,15 +1367,10 @@
<src path="@{pluginlib}/source"/> <src path="@{pluginlib}/source"/>
<classpath> <classpath>
<pathelement location="${plugin.dev.dest.dir}/@{plugin}/target/classes"/> <pathelement location="${plugin.dev.dest.dir}/@{plugin}/target/classes"/>
<path> <path refid="plugin.classpath.source"/>
<path refid="plugin.dependencies"/>
<!-- Jars used by the plugin to compile with -->
<fileset dir="@{pluginsrc}/@{plugin}" includes="lib/*.jar"/>
</path>
</classpath> </classpath>
</of.javac> </of.javac>
<jar jarfile="${plugin.dev.dest.dir}/@{plugin}/target/lib/@{plugin}-lib.jar"> <jar jarfile="${plugin.dev.dest.dir}/@{plugin}/target/lib/@{plugin}-lib.jar">
<fileset dir="@{pluginlib}/classes" /> <fileset dir="@{pluginlib}/classes" />
</jar> </jar>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>Openfire: Database Installation Guide</title> <title>Openfire: Customization Guide</title>
<link href="style.css" rel="stylesheet" type="text/css"> <link href="style.css" rel="stylesheet" type="text/css">
</head> </head>
<body> <body>
......
...@@ -25,6 +25,9 @@ import org.apache.tools.ant.BuildException; ...@@ -25,6 +25,9 @@ import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import java.io.File; 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. * 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 { ...@@ -89,6 +92,12 @@ public class SubDirInfoTask extends Task {
public void execute() throws BuildException { public void execute() throws BuildException {
// Get the siblings of the given directory, add sub directory names to the property // 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(); File[] subdirs = dir.listFiles();
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
String value = null; String value = null;
...@@ -108,7 +117,7 @@ public class SubDirInfoTask extends Task { ...@@ -108,7 +117,7 @@ public class SubDirInfoTask extends Task {
add = true; add = true;
} }
} }
if (add && !subdir.getName().equals(except)) { if (add && !excepts.contains(subdir.getName())) {
buf.append(sep).append(subdir.getName()); buf.append(sep).append(subdir.getName());
sep = getDelimiter(); 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