From 7b5de19ea6cdb4e4351c9b2116d84b26f4053462 Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Mon, 26 Apr 2010 14:33:24 +0000 Subject: 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@938059 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/java/broker-plugins/build.xml | 36 ------------ qpid/java/broker-plugins/extras/build.xml | 3 +- .../org/apache/qpid/server/plugins/PluginTest.java | 61 ++++++++++++++++++++ qpid/java/broker-plugins/src/main/java/.gitignore | 0 .../org/apache/qpid/server/plugins/PluginTest.java | 53 ------------------ qpid/java/build.deps | 44 +++++++-------- qpid/java/build.xml | 9 ++- qpid/java/client/example/build.xml | 3 +- qpid/java/common.xml | 26 +++++++++ qpid/java/module.xml | 65 +++++++++++++++++----- qpid/java/systests/build.xml | 3 +- qpid/java/tasks/src/org/apache/qpid/tasks/Map.java | 31 ++++++----- .../src/org/apache/qpid/tasks/PropertyMapper.java | 30 ++++++++++ 13 files changed, 217 insertions(+), 147 deletions(-) delete mode 100644 qpid/java/broker-plugins/build.xml create mode 100644 qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/PluginTest.java delete mode 100644 qpid/java/broker-plugins/src/main/java/.gitignore delete mode 100644 qpid/java/broker/src/test/java/org/apache/qpid/server/plugins/PluginTest.java create mode 100644 qpid/java/tasks/src/org/apache/qpid/tasks/PropertyMapper.java (limited to 'qpid/java') diff --git a/qpid/java/broker-plugins/build.xml b/qpid/java/broker-plugins/build.xml deleted file mode 100644 index bf793fea70..0000000000 --- a/qpid/java/broker-plugins/build.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/qpid/java/broker-plugins/extras/build.xml b/qpid/java/broker-plugins/extras/build.xml index b8e3aa1ef2..7d8468d5d5 100644 --- a/qpid/java/broker-plugins/extras/build.xml +++ b/qpid/java/broker-plugins/extras/build.xml @@ -20,7 +20,8 @@ nn - or more contributor license agreements. See the NOTICE file --> - + + diff --git a/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/PluginTest.java b/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/PluginTest.java new file mode 100644 index 0000000000..1fc0eb10e1 --- /dev/null +++ b/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/PluginTest.java @@ -0,0 +1,61 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * 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. + * + */ + +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; + +public class PluginTest extends TestCase +{ + + private static final String TEST_EXCHANGE_CLASS = "org.apache.qpid.extras.exchanges.example.TestExchangeType"; + private static final String PLUGIN_DIRECTORY = System.getProperty("example.plugin.target"); + + public void testLoadExchanges() throws Exception + { + PluginManager manager = new PluginManager(PLUGIN_DIRECTORY); + Map> exchanges = manager.getExchanges(); + assertNotNull("No exchanges found in "+PLUGIN_DIRECTORY, exchanges); + assertEquals("Wrong number of exchanges found in "+PLUGIN_DIRECTORY, + 2, exchanges.size()); + assertNotNull("Wrong exchange found in "+PLUGIN_DIRECTORY, + exchanges.get(TEST_EXCHANGE_CLASS)); + } + + public void testNoExchanges() throws Exception + { + PluginManager manager = new PluginManager("/path/to/nowhere"); + Map> 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/qpid/java/broker-plugins/src/main/java/.gitignore b/qpid/java/broker-plugins/src/main/java/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/plugins/PluginTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/plugins/PluginTest.java deleted file mode 100644 index 11d6105704..0000000000 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/plugins/PluginTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * 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. - * - */ - -package org.apache.qpid.server.plugins; - -import java.util.Map; - -import org.apache.qpid.server.exchange.ExchangeType; - -import junit.framework.TestCase; - -public class PluginTest extends TestCase -{ - - private static final String TEST_EXCHANGE_CLASS = "org.apache.qpid.extras.exchanges.example.TestExchangeType"; - private static final String PLUGIN_DIRECTORY = System.getProperty("example.plugin.target"); - - public void testLoadExchanges() throws Exception - { - PluginManager manager = new PluginManager(PLUGIN_DIRECTORY); - Map> exchanges = manager.getExchanges(); - assertNotNull("No exchanges found in "+PLUGIN_DIRECTORY, exchanges); - assertEquals("Wrong number of exchanges found in "+PLUGIN_DIRECTORY, - 2, exchanges.size()); - assertNotNull("Wrong exchange found in "+PLUGIN_DIRECTORY, - exchanges.get(TEST_EXCHANGE_CLASS)); - } - - public void testNoExchanges() throws Exception - { - PluginManager manager = new PluginManager("/path/to/nowhere"); - Map> exchanges = manager.getExchanges(); - assertEquals("Exchanges found", 0, exchanges.size()); - } -} diff --git a/qpid/java/build.deps b/qpid/java/build.deps index f7b26e93d0..13b19e34bc 100644 --- a/qpid/java/build.deps +++ b/qpid/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/qpid/java/build.xml b/qpid/java/build.xml index 6f0648cd9e..e8c9e23a17 100644 --- a/qpid/java/build.xml +++ b/qpid/java/build.xml @@ -22,11 +22,15 @@ + + + + - - + + + diff --git a/qpid/java/client/example/build.xml b/qpid/java/client/example/build.xml index 8bcd59d829..8b0d59bd8a 100644 --- a/qpid/java/client/example/build.xml +++ b/qpid/java/client/example/build.xml @@ -20,7 +20,8 @@ --> - + + diff --git a/qpid/java/common.xml b/qpid/java/common.xml index 611be5a0b8..456d1804fd 100644 --- a/qpid/java/common.xml +++ b/qpid/java/common.xml @@ -93,6 +93,28 @@ + + + + + + + + + + + + + + + + + + + + @@ -109,6 +131,10 @@ + + + - + @@ -73,10 +73,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -84,10 +127,12 @@ + + @@ -107,19 +152,6 @@ - - - - - - - - - - - - - @@ -147,6 +179,8 @@ + + @@ -391,7 +425,10 @@ + + + diff --git a/qpid/java/systests/build.xml b/qpid/java/systests/build.xml index 34a360ecad..c2c20b4bfa 100644 --- a/qpid/java/systests/build.xml +++ b/qpid/java/systests/build.xml @@ -19,8 +19,7 @@ nn - or more contributor license agreements. See the NOTICE file - --> - - + diff --git a/qpid/java/tasks/src/org/apache/qpid/tasks/Map.java b/qpid/java/tasks/src/org/apache/qpid/tasks/Map.java index e456b9e6ab..e66f34b319 100644 --- a/qpid/java/tasks/src/org/apache/qpid/tasks/Map.java +++ b/qpid/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/qpid/java/tasks/src/org/apache/qpid/tasks/PropertyMapper.java b/qpid/java/tasks/src/org/apache/qpid/tasks/PropertyMapper.java new file mode 100644 index 0000000000..35f5af356c --- /dev/null +++ b/qpid/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 -- cgit v1.2.1