summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2010-04-26 14:33:24 +0000
committerMartin Ritchie <ritchiem@apache.org>2010-04-26 14:33:24 +0000
commitff0fe9fcb9c0e82e57d7b1146701fc2861271ce2 (patch)
tree94c166289d21ab09b4e2cd72c3b22720f1a16412
parent67c5accb682e347436f2db76fa007119569ae9be (diff)
downloadqpid-python-ff0fe9fcb9c0e82e57d7b1146701fc2861271ce2.tar.gz
QPID-2530 : Updated build system to have a new findSubProjects macro in build.xml that will correctly locate and add all subprojects (those with a build.xml file) to the modules.plugin variable. This will correctly allow new plugins to be automatically picked up without any further build system changes.
To further simplify the build process and make better use of the module.depends option the build.deps file has been updated to contain only the libraries the module actually depends on. The dependant libraries due to a module.depends are now automatically pulled in by the build system. A further enhancement would be to do transitive dependencies, which would also allow dependencies to be built when in a sub module directory. e.g. client depends on common, but client.libs should not contain mina, common contains mina and so those libraries are pulled in via the fact that client's module.depends contains common. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@938059 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/broker-plugins/build.xml36
-rw-r--r--java/broker-plugins/extras/build.xml3
-rw-r--r--java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/PluginTest.java (renamed from java/broker/src/test/java/org/apache/qpid/server/plugins/PluginTest.java)8
-rw-r--r--java/broker-plugins/src/main/java/.gitignore0
-rw-r--r--java/build.deps44
-rw-r--r--java/build.xml9
-rw-r--r--java/client/example/build.xml3
-rw-r--r--java/common.xml26
-rw-r--r--java/module.xml65
-rw-r--r--java/systests/build.xml3
-rw-r--r--java/tasks/src/org/apache/qpid/tasks/Map.java31
-rw-r--r--java/tasks/src/org/apache/qpid/tasks/PropertyMapper.java30
12 files changed, 164 insertions, 94 deletions
diff --git a/java/broker-plugins/build.xml b/java/broker-plugins/build.xml
deleted file mode 100644
index bf793fea70..0000000000
--- a/java/broker-plugins/build.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
-nn - or more contributor license agreements. See the NOTICE file
- -n distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-<project name="AMQ Broker-Plugins" default="build">
-
- <property name="module.depends" value="client management/common broker common junit-toolkit"/>
- <property name="module.plugin" value="true"/>
-
- <import file="../module.xml"/>
-
- <target name="build">
- <subant target="jar">
- <filelist dir=".">
- <file name="extras/build.xml"/>
- </filelist>
- </subant>
- </target>
-
-</project>
diff --git a/java/broker-plugins/extras/build.xml b/java/broker-plugins/extras/build.xml
index b8e3aa1ef2..7d8468d5d5 100644
--- a/java/broker-plugins/extras/build.xml
+++ b/java/broker-plugins/extras/build.xml
@@ -20,7 +20,8 @@ nn - or more contributor license agreements. See the NOTICE file
-->
<project name="AMQ Broker-Plugins" default="build">
- <property name="module.depends" value="client management/common broker common junit-toolkit"/>
+ <property name="module.depends" value="common client management/common broker broker-plugins junit-toolkit"/>
+ <property name="module.test.depends" value="broker/test"/>
<property name="module.manifest" value="MANIFEST.MF"/>
<property name="module.plugin" value="true"/>
diff --git a/java/broker/src/test/java/org/apache/qpid/server/plugins/PluginTest.java b/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/PluginTest.java
index 11d6105704..1fc0eb10e1 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/plugins/PluginTest.java
+++ b/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/PluginTest.java
@@ -24,6 +24,7 @@ package org.apache.qpid.server.plugins;
import java.util.Map;
import org.apache.qpid.server.exchange.ExchangeType;
+import org.apache.qpid.server.registry.ApplicationRegistry;
import junit.framework.TestCase;
@@ -50,4 +51,11 @@ public class PluginTest extends TestCase
Map<String, ExchangeType<?>> exchanges = manager.getExchanges();
assertEquals("Exchanges found", 0, exchanges.size());
}
+
+ @Override
+ public void tearDown()
+ {
+ // PluginManager will start an ApplicationRegistry instance.
+ ApplicationRegistry.remove(ApplicationRegistry.DEFAULT_INSTANCE);
+ }
}
diff --git a/java/broker-plugins/src/main/java/.gitignore b/java/broker-plugins/src/main/java/.gitignore
deleted file mode 100644
index e69de29bb2..0000000000
--- a/java/broker-plugins/src/main/java/.gitignore
+++ /dev/null
diff --git a/java/build.deps b/java/build.deps
index f7b26e93d0..13b19e34bc 100644
--- a/java/build.deps
+++ b/java/build.deps
@@ -55,7 +55,6 @@ javassist=lib/javassist.jar
jetty=lib/jetty-6.1.14.jar
jetty-util=lib/jetty-util-6.1.14.jar
jetty-bootstrap=lib/start.jar
-jms=lib/jms-1.1.jar
jsp-api=lib/jsp-api-2.1.jar
jsp-impl=lib/jsp-2.1.jar
core-lib=lib/core-3.1.1.jar
@@ -74,32 +73,25 @@ felix-framework=lib/org.apache.felix.framework-1.0.0.jar
geronimo-servlet=lib/geronimo-servlet_2.5_spec-1.2.jar
felix.libs=${osgi-core} ${felix-framework}
-commons-configuration.libs = ${commons-beanutils-core} ${commons-digester} ${commons-codec} ${commons-lang} \
- ${commons-collections} ${commons-configuration}
+commons-configuration.libs = ${commons-beanutils-core} ${commons-digester} \
+ ${commons-codec} ${commons-lang} ${commons-collections} ${commons-configuration}
-common.libs=${slf4j-api} ${slf4j-log4j} ${backport-util-concurrent} ${mina-core} ${mina-filter-ssl}
-
-client.libs=${common.libs} ${geronimo-jms} ${commons-collections}
-tools.libs=${client.libs} ${commons-configuration.libs}
-broker.libs=${common.libs} ${commons-cli} ${commons-logging} ${log4j} \
+common.libs=${slf4j-api} ${backport-util-concurrent} ${mina-core} ${mina-filter-ssl}
+client.libs=${geronimo-jms} ${commons-collections}
+tools.libs=${commons-configuration.libs}
+broker.libs=${commons-cli} ${commons-logging} ${log4j} ${slf4j-log4j} \
${xalan} ${felix.libs} ${derby-db} ${commons-configuration.libs}
-broker-plugins.libs=${common.libs} ${felix.libs} ${log4j} ${commons-configuration.libs}
-broker-plugins-info.libs=${common.libs} ${felix.libs} ${log4j} ${commons-configuration.libs}
-broker-plugins-extras.libs=${common.libs} ${felix.libs} ${log4j} ${commons-configuration.libs}
-management-client.libs=${jsp.libs} ${log4j} ${slf4j-log4j} ${slf4j-api} ${commons-pool} ${geronimo-servlet} ${muse.libs} ${javassist} ${xalan} ${mina-core} ${mina-filter-ssl}
+broker-plugins.libs=${felix.libs} ${log4j} ${commons-configuration.libs}
+management-client.libs=${jsp.libs} ${log4j} ${slf4j-log4j} ${slf4j-api} \
+ ${commons-pool} ${geronimo-servlet} ${muse.libs} ${javassist} ${xalan}
-management-agent.libs=${client.libs} ${commons-logging} ${geronimo-jms}
-management-console.libs=${client.libs} ${commons-logging} ${geronimo-jms}
+management-agent.libs=${commons-logging}
+management-console.libs=${commons-logging}
junit-toolkit.libs=${log4j} ${junit} ${slf4j-api}
test.libs=${slf4j-log4j} ${junit-toolkit.libs}
-systests.libs=${client.libs} ${test.libs} ${broker.libs}
-perftests.libs=${systests.libs}
-integrationtests.libs=${systests.libs}
-
-client-example.libs=${client.libs}
-testkit.libs=${client.libs} ${log4j}
+testkit.libs=${log4j}
ibm-icu=lib/com.ibm.icu_3.8.1.v20080530.jar
ecl-core-jface=lib/org.eclipse.jface_3.4.1.M20080827-2000.jar
@@ -163,18 +155,20 @@ management-eclipse-plugin.platform-libs=${ecl-equinox-launcher-win32-win32-x86}
management-eclipse-plugin.libs=${management-eclipse-plugin.core-libs} ${management-eclipse-plugin.platform-libs}
-management-tools-qpid-cli.libs=${common.libs} ${jline} ${commons-configuration.libs}
+management-tools-qpid-cli.libs=${jline} ${commons-configuration.libs}
common.test.libs=${test.libs}
broker.test.libs=${test.libs}
-client.test.libs=${broker.libs} ${test.libs}
+client.test.libs=${test.libs}
client-example.test.libs=${test.libs}
-tools.test.libs=${client.test.libs}
+tools.test.libs=
testkit.test.libs=${test.libs}
+systests.libs=${test.libs}
+
management-client.test.libs=${muse.libs} ${test.libs} ${log4j} ${javassist} ${geronimo-servlet} ${commons-pool}
-management-console.test.libs=${junit4} ${slf4j-log4j} ${log4j} ${client.libs}
+management-console.test.libs=${junit4} ${slf4j-log4j} ${log4j}
management-agent.test.libs=${junit}
management-eclipse-plugin.test.libs=${systests.libs}
broker-plugins.test.libs=${test.libs}
-management-tools-qpid-cli.test.libs=${junit4} ${slf4j-log4j} ${log4j} ${client.libs}
+management-tools-qpid-cli.test.libs=${junit4} ${slf4j-log4j} ${log4j}
management-common.test.libs=${test.libs}
diff --git a/java/build.xml b/java/build.xml
index 6f0648cd9e..e8c9e23a17 100644
--- a/java/build.xml
+++ b/java/build.xml
@@ -22,11 +22,15 @@
<import file="common.xml"/>
+
+ <findSubProjects name="broker-plugins" dir="broker-plugins"/>
+ <findSubProjects name="management" dir="management" excludes="common,example,tools/qpid-cli"/>
+
<property name="modules.core" value="junit-toolkit common management/common broker client tools"/>
<property name="modules.examples" value="client/example management/example"/>
<property name="modules.tests" value="systests perftests integrationtests testkit"/>
- <property name="modules.management" value="management/client management/eclipse-plugin management/agent management/console"/>
- <property name="modules.plugin" value="broker-plugins"/>
+ <property name="modules.management" value="${management}"/>
+ <property name="modules.plugin" value="${broker-plugins}"/>
<property name="modules.management.tools" value="management/tools/qpid-cli"/>
<property name="modules" value="${modules.core}
${modules.plugin} ${modules.examples}
@@ -41,6 +45,7 @@
<globmapper from="*" to="*/\*\*"/>
</map>
+
<property name="release.zip" location="${release}/${project.namever}-java.zip"/>
<property name="release.tar" location="${release}/${project.namever}-java.tar"/>
<property name="release.tgz" location="${release}/${project.namever}-java.tar.gz"/>
diff --git a/java/client/example/build.xml b/java/client/example/build.xml
index 8bcd59d829..8b0d59bd8a 100644
--- a/java/client/example/build.xml
+++ b/java/client/example/build.xml
@@ -20,7 +20,8 @@
-->
<project name="AMQ Client" default="build">
- <property name="module.depends" value="common client"/>
+ <property name="module.depends" value="client common"/>
+ <property name="module.test.depends" value=""/>
<import file="../../module.xml"/>
diff --git a/java/common.xml b/java/common.xml
index 611be5a0b8..456d1804fd 100644
--- a/java/common.xml
+++ b/java/common.xml
@@ -93,6 +93,28 @@
</sequential>
</macrodef>
+ <macrodef name="findSubProjects">
+ <attribute name="dir"/>
+ <attribute name="name"/>
+ <attribute name="excludes" default=""/>
+
+ <sequential>
+ <dirset id="@{dir}.refid" dir="@{dir}" excludes="@{excludes}">
+ <present targetdir="@{dir}">
+ <mapper type="glob" from="*" to="*/build.xml" />
+ </present>
+ </dirset>
+
+ <pathconvert property="@{name}"
+ refid="@{dir}.refid"
+ pathsep=" ">
+ <map from="${project.root}/" to=""/>
+ </pathconvert>
+ </sequential>
+ </macrodef>
+
+
+
<macrodef name="jython">
<attribute name="path"/>
<element name="args"/>
@@ -109,6 +131,10 @@
<compilerarg line="${javac.compiler.args}"/>
</javac>
+
+ <typedef name="propertymapper" classname="org.apache.qpid.tasks.PropertyMapper"
+ classpath="${tasks.classes}"/>
+
<taskdef name="map" classname="org.apache.qpid.tasks.Map"
classpath="${tasks.classes}"/>
<taskdef name="foreach" classname="org.apache.qpid.tasks.Foreach"
diff --git a/java/module.xml b/java/module.xml
index 27aae0fb9a..ec2bfc7e8e 100644
--- a/java/module.xml
+++ b/java/module.xml
@@ -30,7 +30,7 @@
<filtermapper>
<replacestring from="${file.separator}" to="-"/>
</filtermapper>
- </map>
+ </map>
<echo message="Running ant for module : ${module}" level="info"/>
@@ -73,10 +73,53 @@
<available property="module.etc.exists" file="${module.etc}"/>
<available property="module.bin.exists" file="${module.bin}"/>
+ <!-- module.depends and module.test.depends are supplied by the importing file -->
+ <property name="module.depends" value=""/>
+ <property name="module.test.depends" value=""/>
+ <property name="module.test.excludes" value=""/>
+
+ <map property="module.depends.path" value="${module.depends}" join="${path.separator}">
+ <globmapper from="*" to="${build.scratch}/*/classes"/>
+ </map>
+
+ <map property="module.test.depends.path" value="${module.test.depends}" join="${path.separator}">
+ <globmapper from="*" to="${build.scratch}/*/classes"/>
+ </map>
+
+
+ <!-- Add depenencies dependencies to path -->
+ <map property="module.depends.libs" value="${module.depends}" join=" ">
+ <chainedmapper>
+ <filtermapper>
+ <replacestring from="${file.separator}" to="-"/>
+ </filtermapper>
+ <propertymapper from="*" to="*.libs"/>
+ </chainedmapper>
+ </map>
+ <condition property="module.depends.libs.includes" value="__EMPTY__" else="${module.depends.libs}">
+ <equals trim="true" arg1="${module.depends.libs}" arg2=""/>
+ </condition>
+
+
+ <!-- Add depenencies test dependencies to path -->
+ <map property="module.test.depends.libs" value="${module.test.depends}" join=" ">
+ <chainedmapper>
+ <filtermapper>
+ <replacestring from="${file.separator}" to="-"/>
+ </filtermapper>
+ <propertymapper from="*" to="*.libs"/>
+ </chainedmapper>
+ </map>
+ <condition property="module.test.depends.libs.includes" value="__EMPTY__" else="${module.test.depends.libs}">
+ <equals trim="true" arg1="${module.test.depends.libs}" arg2=""/>
+ </condition>
+
+
<indirect name="module.libs" variable="${module.name}.libs"/>
<condition property="module.libs.includes" value="__EMPTY__" else="${module.libs}">
<equals trim="true" arg1="${module.libs}" arg2=""/>
</condition>
+
<indirect name="module.test.libs" variable="${module.name}.test.libs"/>
<condition property="module.test.libs.includes" value="__EMPTY__" else="${module.test.libs}">
<equals trim="true" arg1="${module.test.libs}" arg2=""/>
@@ -84,10 +127,12 @@
<path id="module.libs">
<fileset dir="${project.root}" includes="${module.libs.includes}"/>
+ <fileset dir="${project.root}" includes="${module.depends.libs.includes}"/>
</path>
<path id="module.test.libs">
<fileset dir="${project.root}" includes="${module.test.libs.includes}"/>
+ <fileset dir="${project.root}" includes="${module.test.depends.libs.includes}"/>
</path>
<path id="module.src.path">
@@ -107,19 +152,6 @@
<property name="module.test.jar"
location="${build.lib}/${project.name}-${module.name}-tests-${project.version}.jar"/>
- <!-- module.depends and module.test.depends are supplied by the importing file -->
- <property name="module.depends" value=""/>
- <property name="module.test.depends" value=""/>
- <property name="module.test.excludes" value=""/>
-
- <map property="module.depends.path" value="${module.depends}" join="${path.separator}">
- <globmapper from="*" to="${build.scratch}/*/classes"/>
- </map>
-
- <map property="module.test.depends.path" value="${module.test.depends}" join="${path.separator}">
- <globmapper from="*" to="${build.scratch}/*/classes"/>
- </map>
-
<path id="module.class.path">
<pathelement location="${module.classes}"/>
<pathelement path="${module.depends.path}"/>
@@ -147,6 +179,8 @@
<echo-prop name="module.depends.path"/>
<echo-prop name="module.test.depends"/>
<echo-prop name="module.test.depends.path"/>
+ <echo-prop name="module.depends.libs"/>
+ <echo-prop name="module.test.depends.libs"/>
<echo-path refid="module.src.path"/>
<echo-path refid="module.class.path"/>
<echo-path refid="module.test.path"/>
@@ -391,7 +425,10 @@
<target name="libs-release" description="copy dependencies into module release">
<!-- Copy the module dependencies -->
+ <echo message="${module.libs}"/>
<copylist todir="${module.release}/lib" dir="${project.root}" files="${module.libs}"/>
+ <copylist todir="${module.release}/lib" dir="${project.root}" files="${module.depends.libs}"/>
+
<!-- Copy the jar for this module -->
<copy todir="${module.release}/lib" failonerror="true">
<fileset file="${module.jar}"/>
diff --git a/java/systests/build.xml b/java/systests/build.xml
index 34a360ecad..c2c20b4bfa 100644
--- a/java/systests/build.xml
+++ b/java/systests/build.xml
@@ -19,8 +19,7 @@ nn - or more contributor license agreements. See the NOTICE file
-
-->
<project name="System Tests" default="build">
-
- <property name="module.depends" value="client management/tools/qpid-cli management/eclipse-plugin management/common broker broker/test common common/test nt junit-toolkit"/>
+ <property name="module.depends" value="client management/tools/qpid-cli management/eclipse-plugin management/common broker broker/test common common/test junit-toolkit"/>
<property name="module.test.src" location="src/main/java"/>
<property name="module.test.excludes"
value="**/TTLTest.java,**/DropInTest.java,**/TestClientControlledTest.java"/>
diff --git a/java/tasks/src/org/apache/qpid/tasks/Map.java b/java/tasks/src/org/apache/qpid/tasks/Map.java
index e456b9e6ab..e66f34b319 100644
--- a/java/tasks/src/org/apache/qpid/tasks/Map.java
+++ b/java/tasks/src/org/apache/qpid/tasks/Map.java
@@ -21,16 +21,10 @@
package org.apache.qpid.tasks;
import org.apache.tools.ant.BuildException;
-
import org.apache.tools.ant.util.ChainedMapper;
import org.apache.tools.ant.util.FileNameMapper;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Map -- an ant task that allows arbitrary use of FileNameMappers
- **/
+/** Map -- an ant task that allows arbitrary use of FileNameMappers */
public class Map extends BaseTask {
@@ -75,14 +69,25 @@ public class Map extends BaseTask {
String[] parts = value.split(split);
StringBuffer buf = new StringBuffer();
- for (int i = 0; i < parts.length; i++) {
- if (parts[i].length() == 0) { continue; }
+ for (int i = 0; i < parts.length; i++)
+ {
+ if (parts[i].length() == 0)
+ {
+ continue;
+ }
String[] names = mapper.mapFileName(parts[i]);
- for (int j = 0; j < names.length; j++) {
- if (buf.length() > 0) {
- buf.append(join);
+
+ //Mappers can return null.
+ if (names != null)
+ {
+ for (int j = 0; j < names.length; j++)
+ {
+ if (buf.length() > 0)
+ {
+ buf.append(join);
+ }
+ buf.append(names[j]);
}
- buf.append(names[j]);
}
}
diff --git a/java/tasks/src/org/apache/qpid/tasks/PropertyMapper.java b/java/tasks/src/org/apache/qpid/tasks/PropertyMapper.java
new file mode 100644
index 0000000000..35f5af356c
--- /dev/null
+++ b/java/tasks/src/org/apache/qpid/tasks/PropertyMapper.java
@@ -0,0 +1,30 @@
+package org.apache.qpid.tasks;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.util.GlobPatternMapper;
+
+public class PropertyMapper extends GlobPatternMapper
+{
+
+ Project _project;
+
+ public PropertyMapper(Project project)
+ {
+ super();
+ _project = project;
+ }
+
+ public String[] mapFileName(String sourceFileName)
+ {
+ String[] fixed = super.mapFileName(sourceFileName);
+
+ if (fixed == null)
+ {
+ return null;
+ }
+
+ return new String[]{ _project.getProperty(fixed[0]) };
+ }
+
+
+} \ No newline at end of file