You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2013/09/24 01:24:18 UTC

svn commit: r1525730 - in /qpid/trunk/qpid/java: broker-plugins/access-control/build.xml broker/build-generate-sources.xml broker/build.xml common/build-generate-sources.xml common/build.xml module.xml

Author: robbie
Date: Mon Sep 23 23:24:18 2013
New Revision: 1525730

URL: http://svn.apache.org/r1525730
Log:
QPID-5158: extract the generation process for the common and broker modules into dedicated build files

Added:
    qpid/trunk/qpid/java/broker/build-generate-sources.xml
    qpid/trunk/qpid/java/common/build-generate-sources.xml
Modified:
    qpid/trunk/qpid/java/broker-plugins/access-control/build.xml
    qpid/trunk/qpid/java/broker/build.xml
    qpid/trunk/qpid/java/common/build.xml
    qpid/trunk/qpid/java/module.xml

Modified: qpid/trunk/qpid/java/broker-plugins/access-control/build.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/access-control/build.xml?rev=1525730&r1=1525729&r2=1525730&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/access-control/build.xml (original)
+++ qpid/trunk/qpid/java/broker-plugins/access-control/build.xml Mon Sep 23 23:24:18 2013
@@ -29,8 +29,10 @@
 
     <import file="../../module.xml" />
 
-    <target name="bundle" depends="bundle-tasks"/>
+    <import file="${project.root}/broker/build-generate-sources.xml"/>
+
+    <target name="precompile" depends="generate-logmessages"/>
 
-    <target name="precompile" depends="gen_logging"/>
+    <target name="bundle" depends="bundle-tasks"/>
 
 </project>

Added: qpid/trunk/qpid/java/broker/build-generate-sources.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/build-generate-sources.xml?rev=1525730&view=auto
==============================================================================
--- qpid/trunk/qpid/java/broker/build-generate-sources.xml (added)
+++ qpid/trunk/qpid/java/broker/build-generate-sources.xml Mon Sep 23 23:24:18 2013
@@ -0,0 +1,97 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<project name="QpidBrokerGenerateSources" default="generate-logmessages">
+
+    <!-- Additions to perform LogMessage generation. To enable for a given
+    module using the Ant build, add the following to the build.xml:
+
+    <import file="${project.root}/broker/build-generate-sources.xml"/>
+
+    <target name="precompile" depends="generate-logmessages"/> -->
+
+    <dirname property="QpidBrokerGenerateSources.basedir" file="${ant.file.QpidBrokerGenerateSources}"/>
+
+    <property name="gentools.classes" location="${build.scratch}/common/gentools" />
+    <property name="generated-logmessages-dir" location="${module.precompiled}" />
+    <property name="velocity.classes" value="${build.scratch}/broker/velocity"/>
+    <property name="velocity.timestamp" location="${generated-logmessages-dir}/velocity.timestamp" />
+    <property name="velocity.src.dir" value="${QpidBrokerGenerateSources.basedir}/src/velocity/java"/>
+    <property name="velocity.template.dir" value="${QpidBrokerGenerateSources.basedir}/src/velocity/templates/org/apache/qpid/server/logging/messages"/>
+
+    <path id="source.generation.classpathref">
+          <pathelement path="${project.root}/${velocity.jar}" />
+          <pathelement path="${project.root}/${velocity-dep.jar}" />
+    </path>
+
+    <target name="compile-logmessages-generator" >
+        <mkdir dir="${velocity.classes}" />
+        <!-- Compile LogMessages Velocity Generator -->
+        <javac source="1.5" target="1.5"
+               destdir="${velocity.classes}" debug="on" includeantruntime="false"
+               srcdir="${velocity.src.dir}" >
+          <classpath>
+            <path refid="source.generation.classpathref"/>
+          </classpath>
+        </javac>
+    </target>
+
+    <target name="check-logmessages-generation-required">
+      <uptodate property="logmessages-generation-not-required" targetfile="${velocity.timestamp}">
+        <srcfiles dir="${module.src}" includes="**/*_logmessages.properties" />
+        <srcfiles dir="${velocity.src.dir}" includes="**/*.java **/*.vm" />
+      </uptodate>
+    </target>
+
+    <target name="generate-logmessages" depends="compile-logmessages-generator,check-logmessages-generation-required" unless="logmessages-generation-not-required">
+      <mkdir dir="${generated-logmessages-dir}"/>
+
+      <path id="logmessages.path">
+        <fileset  dir="${module.src}">
+          <include name="**/*_logmessages.properties"/>
+        </fileset>
+      </path>
+
+      <pathconvert property="logmessages"
+                   refid="logmessages.path"
+                   pathsep="' '"/>
+
+      <echo message="logmessages is ${logmessages}"/>
+
+      <java classname="org.apache.qpid.server.logging.GenerateLogMessages" fork="true" dir="${gentools.classes}" failonerror="true">
+        <arg line="'${logmessages}'"/>
+          <arg value="-j"/>
+          <arg value="-o"/>
+          <arg value="${generated-logmessages-dir}"/>
+          <arg value="-t"/>
+          <arg value="${velocity.template.dir}"/>
+          <arg value="-s"/>
+          <arg value="${module.src}"/>
+
+        <classpath>
+          <pathelement path="${module.src}"/>
+          <pathelement path="${velocity.classes}" />
+          <path refid="source.generation.classpathref"/>
+        </classpath>
+      </java>
+      <touch file="${velocity.timestamp}" />
+    </target>
+
+</project>

Modified: qpid/trunk/qpid/java/broker/build.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/build.xml?rev=1525730&r1=1525729&r2=1525730&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/build.xml (original)
+++ qpid/trunk/qpid/java/broker/build.xml Mon Sep 23 23:24:18 2013
@@ -31,9 +31,9 @@
 
     <import file="../module.xml"/>
 
-    <property name="output.dir" value="${module.precompiled}/org/apache/qpid/server/filter/jms/selector"/>
+    <import file="${project.root}/broker/build-generate-sources.xml"/>
 
-    <target name="precompile" depends="gen_logging"/>
+    <target name="precompile" depends="generate-logmessages"/>
 
     <target name="copy-etc-release" if="module.etc.exists" description="copy etc directory if it exists to build tree">
       <copy todir="${module.release}/etc" failonerror="false" flatten="true">

Added: qpid/trunk/qpid/java/common/build-generate-sources.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/build-generate-sources.xml?rev=1525730&view=auto
==============================================================================
--- qpid/trunk/qpid/java/common/build-generate-sources.xml (added)
+++ qpid/trunk/qpid/java/common/build-generate-sources.xml Mon Sep 23 23:24:18 2013
@@ -0,0 +1,128 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<project name="Qpid Common Generate Sources" default="generate-sources">
+
+  <fail message="A required property was not set">
+    <condition>
+      <not>
+        <and>
+          <isset property="generated-amqp-0-8-dir"/>
+          <isset property="generated-amqp-0-10-dir"/>
+          <isset property="gentools.classes"/>
+        </and>
+      </not>
+    </condition>
+  </fail>
+
+  <property name="mllib.dir" value="${basedir}/../../python"/>
+  <property name="xml.spec.dir" value="${basedir}/../../specs"/>
+
+  <property name="xml.spec.0-8" value="amqp0-8-qpid.stripped.xml"/>
+  <property name="xml.spec.0-9" value="amqp0-9-qpid.stripped.xml"/>
+  <property name="xml.spec.0-9-1" value="amqp0-9-1.stripped.xml"/>
+  <property name="xml.spec.0-10" value="amqp.0-10-qpid-errata.stripped.xml"/>
+  <property name="xml.spec.deps.0-8" value="${xml.spec.0-8} ${xml.spec.0-9} ${xml.spec.0-9-1}"/>
+  <property name="xml.spec.list.0-8" value='"${xml.spec.dir}/${xml.spec.0-8}" "${xml.spec.dir}/${xml.spec.0-9}" "${xml.spec.dir}/${xml.spec.0-9-1}"'/>
+
+  <property name="gentools.src" value="${basedir}/gentools/src"/>
+  <property name="generated.package" value="org/apache/qpid/framing" />
+
+  <property name="amqp-0-8-generation.timestamp" location="${generated-amqp-0-8-dir}/amqp-0-8-generation.timestamp" />
+  <property name="amqp-0-10-generation.timestamp" location="${generated-amqp-0-10-dir}/amqp-0-10-generation.timestamp" />
+
+  <property name="version.file" location="${basedir}/target/classes/qpidversion.properties"/>
+  <property file="${version.file}" prefix="old."/>
+
+  <target name="check-version">
+    <exec executable="svnversion" spawn="false" failifexecutionfails="false"
+        dir="${basedir}" outputproperty="svnversion.output">
+      <arg line="."/>
+    </exec>
+    <condition property="version.stale">
+      <not>
+        <equals arg1="${svnversion.output}" arg2="${old.qpid.svnversion}"/>
+      </not>
+    </condition>
+  </target>
+
+  <target name="create-version" depends="check-version" if="version.stale">
+    <echo message="Writing new qpidversion.properties file with svnversion: '${svnversion.output}'"/>
+    <!-- Write the version.properties out.-->
+    <!-- Echos exactly as shown, so leave no spaces before/after lines -->
+    <echo file="${version.file}" append="false">qpid.version=${project.version}
+qpid.svnversion=${svnversion.output}
+qpid.name=qpid
+</echo>
+  </target>
+
+  <target name="check-amqp-0-10-generation-required">
+    <uptodate property="amqp-0-10-generation-not-required" targetfile="${amqp-0-10-generation.timestamp}">
+      <srcfiles dir="${xml.spec.dir}" includes="amqp.0-10-qpid-errata.stripped.xml" />
+    </uptodate>
+  </target>
+
+  <target name="amqp-0-10-generation" depends="check-amqp-0-10-generation-required" unless="amqp-0-10-generation-not-required">
+      <mkdir dir="${generated-amqp-0-10-dir}"/>
+      <echo message="Generating AMQP 0-10 protocol classes..."/>
+      <java classname="org.python.util.jython" dir="${generated-amqp-0-10-dir}" fork="true" failonerror="true">
+        <arg value="${basedir}/codegen"/>
+        <arg value="${generated-amqp-0-10-dir}"/>
+        <arg value="${xml.spec.dir}/${xml.spec.0-10}"/>
+        <arg value="${basedir}"/>
+        <classpath>
+          <path refid="source.generation.classpathref"/>
+        </classpath>
+        <sysproperty key="python.path" value ="${mllib.dir}"/>
+      </java>
+    <touch file="${amqp-0-10-generation.timestamp}" />
+  </target>
+
+  <target name="compile-gentools">
+    <mkdir dir="${gentools.classes}"/>
+    <javac srcdir="${gentools.src}" destdir="${gentools.classes}" source="1.5" target="1.5" fork="true" includeantruntime="false">
+      <classpath>
+        <path refid="source.generation.classpathref"/>
+      </classpath>
+    </javac>
+  </target>
+
+  <target name="check-amqp-0-8-generation-required">
+    <uptodate property="amqp-0-8-generation-not-required" targetfile="${amqp-0-8-generation.timestamp}">
+      <srcfiles dir="${xml.spec.dir}" includes="${xml.spec.deps.0-8}" />
+    </uptodate>
+  </target>
+
+  <target name="amqp-0-8-generation" depends="compile-gentools, check-amqp-0-8-generation-required" unless="amqp-0-8-generation-not-required">
+    <mkdir dir="${generated-amqp-0-8-dir}/${generated.package}"/>
+    <echo message="Generating AMQP 0-8/0-9/0-9-1 protocol classes..."/>
+    <java classname="org.apache.qpid.gentools.Main" fork="true" dir="${gentools.classes}" failonerror="true">
+      <arg line='-j -o "${generated-amqp-0-8-dir}/${generated.package}" -t "${basedir}/templates" ${xml.spec.list.0-8}'/>
+      <classpath>
+        <pathelement path="${gentools.classes}" />
+        <path refid="source.generation.classpathref"/>
+      </classpath>
+    </java>
+    <touch file="${amqp-0-8-generation.timestamp}" />
+  </target>
+
+  <target name="generate-sources" depends="amqp-0-8-generation, amqp-0-10-generation, create-version"/>
+
+</project>

Modified: qpid/trunk/qpid/java/common/build.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/build.xml?rev=1525730&r1=1525729&r2=1525730&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common/build.xml (original)
+++ qpid/trunk/qpid/java/common/build.xml Mon Sep 23 23:24:18 2013
@@ -24,62 +24,21 @@
 
   <import file="../module.xml"/>
 
-  <property name="generated.package" value="org/apache/qpid/framing" />
-  <property name="framing.generated.dir" location="${module.precompiled}/${generated.package}" />
-  <property name="xml.spec.dir" location="${project.root}/../specs" />
-  <property name="xml.spec.deps" value="amqp0-8-qpid.stripped.xml amqp0-9-qpid.stripped.xml amqp0-9-1.stripped.xml" />
-  <property name="xml.spec.list" value='"${xml.spec.dir}/amqp0-8-qpid.stripped.xml" "${xml.spec.dir}/amqp0-9-qpid.stripped.xml" "${xml.spec.dir}/amqp0-9-1.stripped.xml"' />
-  <property name="gentools.timestamp" location="${framing.generated.dir}/gentools.timestamp" />
-  <property name="jython.timestamp" location="${framing.generated.dir}/jython.timestamp" />
   <property name="selector.output.dir" value="${module.precompiled}/org/apache/qpid/filter/selector"/>
 
-  <target name="check_jython_deps">
-    <uptodate property="jython.notRequired" targetfile="${jython.timestamp}">
-      <srcfiles dir="${xml.spec.dir}" includes="amqp.0-10-qpid-errata.stripped.xml" />
-    </uptodate>
-  </target>
-
-  <target name="jython" depends="check_jython_deps" unless="jython.notRequired">
-    <jython path="${mllib.dir}">
-      <args>
-        <arg value="${basedir}/codegen"/>
-        <arg value="${module.precompiled}"/>
-        <arg value="${xml.spec.dir}/amqp.0-10-qpid-errata.stripped.xml"/>
-        <arg value="${basedir}"/>
-      </args>
-    </jython>
-    <touch file="${jython.timestamp}" />
-  </target>
-
-  <target name="compile_gentools">
-    <mkdir dir="${gentools.build}/classes"/>
-    <javac srcdir="${gentools.home}/src" destdir="${gentools.build}/classes" source="${java.source}" target="${java.target}" fork="true" includeantruntime="false">
-      <classpath>
-        <fileset dir="${project.root}">
-          <include name="${velocity.jar}"/>
-          <include name="${velocity-dep.jar}"/>
-        </fileset>
-      </classpath>
-    </javac>
-  </target>
-
-  <target name="check_gentool_deps">
-    <uptodate property="gentools.notRequired" targetfile="${gentools.timestamp}">
-      <srcfiles dir="${xml.spec.dir}" includes="${xml.spec.deps}" />
-    </uptodate>
-  </target>
-
-  <target name="gentools" depends="compile_gentools,check_gentool_deps" unless="gentools.notRequired">
-    <mkdir dir="${framing.generated.dir}"/>
-    <java classname="org.apache.qpid.gentools.Main" fork="true" dir="${gentools.build}/classes" failonerror="true">
-      <arg line='-j -o "${framing.generated.dir}" -t "${project.root}/common/templates" ${xml.spec.list}'/>
-      <classpath>
-        <pathelement path="${gentools.build}/classes" />
+  <path id="common.source.generation.classpathref">
+        <pathelement path="${project.root}/${jython}" />
         <pathelement path="${project.root}/${velocity.jar}" />
         <pathelement path="${project.root}/${velocity-dep.jar}" />
-      </classpath>
-    </java>
-    <touch file="${gentools.timestamp}" />
+  </path>
+
+  <target name="generate-sources">
+    <ant antfile="build-generate-sources.xml">
+      <reference torefid="source.generation.classpathref" refid="common.source.generation.classpathref" />
+      <property name="generated-amqp-0-8-dir" value="${module.precompiled}"/>
+      <property name="generated-amqp-0-10-dir" value="${module.precompiled}"/>
+      <property name="gentools.classes" value="${build.scratch}/common/gentools/classes"/>
+    </ant>
   </target>
 
   <target name="jms-selector">
@@ -94,7 +53,7 @@
             javacchome="${module.build}"/>
   </target>
 
-  <target name="precompile" depends="gentools,jython,create-version,jms-selector"/>
+  <target name="precompile" depends="generate-sources,jms-selector"/>
 
   <target name="bundle" depends="bundle-tasks"/>
 

Modified: qpid/trunk/qpid/java/module.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/module.xml?rev=1525730&r1=1525729&r2=1525730&view=diff
==============================================================================
--- qpid/trunk/qpid/java/module.xml (original)
+++ qpid/trunk/qpid/java/module.xml Mon Sep 23 23:24:18 2013
@@ -818,80 +818,6 @@ qpid.name=${project.name}
 </echo>
   </target>
 
-   <!-- Additions to perform LogMessage generation
-    To activate for your plugin add the following to your plugin build.xml
-
-    <target name="precompile" depends="gen_logging"/>
-
-   -->
-
-    <property name="gentools.home" location="${project.root}/common/gentools" />
-    <property name="gentools.build" location="${build.scratch}/common/gentools" />
-    <property name="generated.dir" location="${module.precompiled}" />
-    <property name="velocity.compile.dir" value="${build.scratch}/broker/velocity"/>
-    <property name="velocity.timestamp" location="${generated.dir}/velocity.timestamp" />
-
-    <target name="compile_velocity" >
-        <mkdir dir="${velocity.compile.dir}" />
-        <!-- Compile LogMessages Velocity Generator -->
-        <javac source="${java.source}" target="${java.target}"
-               destdir="${velocity.compile.dir}" debug="on" includeantruntime="false"
-               deprecation="${javac.deprecation}"
-               srcdir="${project.root}/broker/src/velocity/java" >
-          <classpath>
-            <pathelement path="${project.root}/${velocity.jar}" />
-          </classpath>
-          <compilerarg line="${javac.compiler.args}"/>
-        </javac>
-    </target>
-
-
-    <target name="check_velocity_deps">
-      <uptodate property="velocity.notRequired" targetfile="${velocity.timestamp}">
-        <srcfiles dir="${module.src}" includes="**/*_logmessages.properties" />
-        <srcfiles dir="${project.root}/broker/src/velocity/" includes="**/*.java **/*.vm" />
-      </uptodate>
-    </target>
-
-
-    <target name="gen_logging" depends="compile_velocity,check_velocity_deps" unless="velocity.notRequired">
-      <mkdir dir="${generated.dir}"/>
-
-      <path id="logmessages.path">
-        <fileset  dir="${module.src}">
-          <include name="**/*_logmessages.properties"/>
-        </fileset>
-      </path>
-
-      <pathconvert property="logmessages"
-                   refid="logmessages.path"
-                   pathsep="' '"/>
-
-      <echo message="logmessages is ${logmessages}"/>
-
-      <java classname="org.apache.qpid.server.logging.GenerateLogMessages" fork="true" dir="${gentools.build}/classes" failonerror="true">
-        <arg line="'${logmessages}'"/>
-          <arg value="-j"/>
-          <arg value="-o"/>
-          <arg value="${generated.dir}"/>
-          <arg value="-t"/>
-          <arg value="${project.root}/broker/src/velocity/templates/org/apache/qpid/server/logging/messages"/>
-          <arg value="-s"/>
-          <arg value="${module.src}"/>
-
-
-        <classpath>
-          <pathelement path="${module.src}"/>
-          <pathelement path="${velocity.compile.dir}" />
-          <fileset dir="${project.root}/lib/required">
-            <include name="**/*.jar"/>
-          </fileset>
-          <pathelement path="${project.root}/${velocity.jar}" />
-        </classpath>
-      </java>
-      <touch file="${velocity.timestamp}" />
-    </target>
-
     <target name="eclipse" depends="eclipse-setup,eclipse-project,eclipse-source-only,eclipse-source-and-test"/>
 
     <target name="eclipse-setup">



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org