Author: ritchiem
Date: Mon Apr 26 14:33:24 2010
New Revision: 938059

URL: http://svn.apache.org/viewvc?rev=938059&view=rev
Log:
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.

Added:
    qpid/trunk/qpid/java/broker-plugins/extras/src/test/
    qpid/trunk/qpid/java/broker-plugins/extras/src/test/java/
    qpid/trunk/qpid/java/broker-plugins/extras/src/test/java/org/
    qpid/trunk/qpid/java/broker-plugins/extras/src/test/java/org/apache/
    qpid/trunk/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/
    
qpid/trunk/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/
    
qpid/trunk/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/
    
qpid/trunk/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/PluginTest.java
      - copied, changed from r938026, 
qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/plugins/PluginTest.java
    qpid/trunk/qpid/java/tasks/src/org/apache/qpid/tasks/PropertyMapper.java
Removed:
    qpid/trunk/qpid/java/broker-plugins/build.xml
    qpid/trunk/qpid/java/broker-plugins/src/main/java/.gitignore
    
qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/plugins/PluginTest.java
Modified:
    qpid/trunk/qpid/java/broker-plugins/extras/build.xml
    qpid/trunk/qpid/java/build.deps
    qpid/trunk/qpid/java/build.xml
    qpid/trunk/qpid/java/client/example/build.xml
    qpid/trunk/qpid/java/common.xml
    qpid/trunk/qpid/java/module.xml
    qpid/trunk/qpid/java/systests/build.xml
    qpid/trunk/qpid/java/tasks/src/org/apache/qpid/tasks/Map.java

Modified: qpid/trunk/qpid/java/broker-plugins/extras/build.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/extras/build.xml?rev=938059&r1=938058&r2=938059&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/extras/build.xml (original)
+++ qpid/trunk/qpid/java/broker-plugins/extras/build.xml Mon Apr 26 14:33:24 
2010
@@ -20,7 +20,8 @@ nn - or more contributor license agreeme
  -->
 <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"/>
 

Copied: 
qpid/trunk/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/PluginTest.java
 (from r938026, 
qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/plugins/PluginTest.java)
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/PluginTest.java?p2=qpid/trunk/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/PluginTest.java&p1=qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/plugins/PluginTest.java&r1=938026&r2=938059&rev=938059&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/plugins/PluginTest.java
 (original)
+++ 
qpid/trunk/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/PluginTest.java
 Mon Apr 26 14:33:24 2010
@@ -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);
+    }
 }

Modified: qpid/trunk/qpid/java/build.deps
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/build.deps?rev=938059&r1=938058&r2=938059&view=diff
==============================================================================
--- qpid/trunk/qpid/java/build.deps (original)
+++ qpid/trunk/qpid/java/build.deps Mon Apr 26 14:33:24 2010
@@ -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.fra
 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=
 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}

Modified: qpid/trunk/qpid/java/build.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/build.xml?rev=938059&r1=938058&r2=938059&view=diff
==============================================================================
--- qpid/trunk/qpid/java/build.xml (original)
+++ qpid/trunk/qpid/java/build.xml Mon Apr 26 14:33:24 2010
@@ -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"/>

Modified: qpid/trunk/qpid/java/client/example/build.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/example/build.xml?rev=938059&r1=938058&r2=938059&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/example/build.xml (original)
+++ qpid/trunk/qpid/java/client/example/build.xml Mon Apr 26 14:33:24 2010
@@ -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"/>
 

Modified: qpid/trunk/qpid/java/common.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common.xml?rev=938059&r1=938058&r2=938059&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common.xml (original)
+++ qpid/trunk/qpid/java/common.xml Mon Apr 26 14:33:24 2010
@@ -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"

Modified: qpid/trunk/qpid/java/module.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/module.xml?rev=938059&r1=938058&r2=938059&view=diff
==============================================================================
--- qpid/trunk/qpid/java/module.xml (original)
+++ qpid/trunk/qpid/java/module.xml Mon Apr 26 14:33:24 2010
@@ -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}"/>

Modified: qpid/trunk/qpid/java/systests/build.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/build.xml?rev=938059&r1=938058&r2=938059&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/build.xml (original)
+++ qpid/trunk/qpid/java/systests/build.xml Mon Apr 26 14:33:24 2010
@@ -19,8 +19,7 @@ nn - or more contributor license agreeme
  -
  -->
 <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"/>

Modified: qpid/trunk/qpid/java/tasks/src/org/apache/qpid/tasks/Map.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/tasks/src/org/apache/qpid/tasks/Map.java?rev=938059&r1=938058&r2=938059&view=diff
==============================================================================
--- qpid/trunk/qpid/java/tasks/src/org/apache/qpid/tasks/Map.java (original)
+++ qpid/trunk/qpid/java/tasks/src/org/apache/qpid/tasks/Map.java Mon Apr 26 
14:33:24 2010
@@ -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]);
             }
         }
 

Added: qpid/trunk/qpid/java/tasks/src/org/apache/qpid/tasks/PropertyMapper.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/tasks/src/org/apache/qpid/tasks/PropertyMapper.java?rev=938059&view=auto
==============================================================================
--- qpid/trunk/qpid/java/tasks/src/org/apache/qpid/tasks/PropertyMapper.java 
(added)
+++ qpid/trunk/qpid/java/tasks/src/org/apache/qpid/tasks/PropertyMapper.java 
Mon Apr 26 14:33:24 2010
@@ -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



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org

Reply via email to