You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2007/01/08 16:22:06 UTC

svn commit: r494092 - in /incubator/qpid/trunk/qpid: gentools/src/org/apache/qpid/gentools/Main.java java/common/pom.xml java/common/protocol-version.xml

Author: kpvdr
Date: Mon Jan  8 07:22:05 2007
New Revision: 494092

URL: http://svn.apache.org/viewvc?view=rev&rev=494092
Log:
Fixed: [QPID-253] Existing classpath breaks codegen; [QPID-254] Build failure does not prevent timestamp from being generated. Also moved all required properties into ant build file, allowing the generation to be completed independently of Maven from the common directory.

Modified:
    incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/Main.java
    incubator/qpid/trunk/qpid/java/common/pom.xml
    incubator/qpid/trunk/qpid/java/common/protocol-version.xml

Modified: incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/Main.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/Main.java?view=diff&rev=494092&r1=494091&r2=494092
==============================================================================
--- incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/Main.java (original)
+++ incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/Main.java Mon Jan  8 07:22:05 2007
@@ -261,19 +261,30 @@
     
 	public static void main(String[] args)
 	{
+		int exitCode = 1;
 		// TODO: This is a simple and klunky way of hangling command-line args, and could be improved upon.
 		if (args.length < 2)
+		{
 			usage();
-		try { new Main().run(args); }
-		catch (IOException e) { e.printStackTrace(); }
-		catch (ParserConfigurationException e) { e.printStackTrace(); }
-		catch (SAXException e) { e.printStackTrace(); }
-		catch (AmqpParseException e) { e.printStackTrace(); }
-		catch (AmqpTypeMappingException e) { e.printStackTrace(); }
-		catch (AmqpTemplateException e) { e.printStackTrace(); }
-		catch (TargetDirectoryException e) { e.printStackTrace(); }
-		catch (IllegalAccessException e) { e.printStackTrace(); }
-		catch (InvocationTargetException e) { e.printStackTrace(); }
+		}
+		else
+		{
+			try
+			{
+				new Main().run(args);
+				exitCode = 0;
+			}
+			catch (IOException e) { e.printStackTrace(); }
+			catch (ParserConfigurationException e) { e.printStackTrace(); }
+			catch (SAXException e) { e.printStackTrace(); }
+			catch (AmqpParseException e) { e.printStackTrace(); }
+			catch (AmqpTypeMappingException e) { e.printStackTrace(); }
+			catch (AmqpTemplateException e) { e.printStackTrace(); }
+			catch (TargetDirectoryException e) { e.printStackTrace(); }
+			catch (IllegalAccessException e) { e.printStackTrace(); }
+			catch (InvocationTargetException e) { e.printStackTrace(); }
+		}
+		System.exit(exitCode);
 	}
 
 	public static void usage()
@@ -287,7 +298,6 @@
         System.out.println("                         Defaults: \"" + defaultCppTemplateDir + "\" for C++;");
         System.out.println("                                   \"" + defaultJavaTemplateDir + "\" for java.");
 		System.out.println("             XMLfile is a space-separated list of AMQP XML files to be parsed.");
-		System.exit(0);
 	}
 	
 	public static String ListTemplateList(File[] list)

Modified: incubator/qpid/trunk/qpid/java/common/pom.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/pom.xml?view=diff&rev=494092&r1=494091&r2=494092
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/pom.xml (original)
+++ incubator/qpid/trunk/qpid/java/common/pom.xml Mon Jan  8 07:22:05 2007
@@ -36,12 +36,11 @@
     <properties>
         <topDirectoryLocation>..</topDirectoryLocation>
         <gentools.home>${topDirectoryLocation}/../gentools</gentools.home>
-        <generated.path>${project.build.directory}/generated-sources/xsl</generated.path>
+        <generated.path>${project.build.directory}/generated-sources/gentools</generated.path>
         <generated.package>org/apache/qpid/framing</generated.package>
         <generated.dir>${generated.path}/${generated.package}</generated.dir>
         <generated.timestamp>${generated.dir}/timestamp</generated.timestamp>
         <specs.dir>${topDirectoryLocation}/../specs</specs.dir>
-        <cluster.asl>${basedir}/src/main/xsl/cluster.asl</cluster.asl>
     </properties>
 
     <build>
@@ -55,14 +54,7 @@
                         <phase>generate-sources</phase>
                         <configuration>
                             <tasks>
-                                <ant antfile="protocol-version.xml">
-									<property name="gentools.home" value="${gentools.home}"/>
-                                    <property name="generated.dir" value="${generated.dir}"/>
-                                    <property name="generated.timestamp" value="${generated.timestamp}"/>
-                                    <property name="xml.spec.dir" value="${specs.dir}"/>
-                                    <property name="xml.spec.deps" value="amqp.0-8.xml cluster.0-8.xml"/>
-                                    <property name="xml.spec.list" value="${specs.dir}/amqp.0-8.xml ${specs.dir}/cluster.0-8.xml"/>
-                                </ant>
+                                <ant antfile="protocol-version.xml" />
                             </tasks>
                             <sourceRoot>${generated.path}</sourceRoot>
                         </configuration>

Modified: incubator/qpid/trunk/qpid/java/common/protocol-version.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/protocol-version.xml?view=diff&rev=494092&r1=494091&r2=494092
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/protocol-version.xml (original)
+++ incubator/qpid/trunk/qpid/java/common/protocol-version.xml Mon Jan  8 07:22:05 2007
@@ -19,11 +19,24 @@
  -
  -->
 <project name="Qpid Common Protocol Versions" default="generate">
+  <property name="topDirectoryLocation" location=".." />
+  <property name="project.build.directory" location="target" />
+  <property name="gentools.home" location="${topDirectoryLocation}/../gentools" />
+  <property name="generated.path" location="${project.build.directory}/generated-sources/gentools" />
+  <property name="generated.package" value="org/apache/qpid/framing" />
+  <property name="generated.dir" location="${generated.path}/${generated.package}" />
+  <property name="generated.timestamp" location="${generated.dir}/timestamp" />
+  <property name="xml.spec.dir" location="${topDirectoryLocation}/../specs" />
+  <property name="xml.spec.deps" value="amqp.0-8.xml cluster.0-8.xml" />
+  <property name="xml.spec.list" value="${xml.spec.dir}/amqp.0-8.xml ${xml.spec.dir}/cluster.0-8.xml" />
   	
   <target name="generate" depends="compile_generator,check_generate_deps" unless="generation.notRequired">
     <mkdir dir="${generated.dir}"/>
-    <java classname="org.apache.qpid.gentools.Main" fork="true" dir="${gentools.home}/src">
+    <java classname="org.apache.qpid.gentools.Main" fork="true" dir="${gentools.home}/src" failonerror="true">
     	<arg line="-j -o ${generated.dir} -t ${gentools.home}/templ.java ${xml.spec.list}" />
+        <classpath>
+          <pathelement path="${gentools.home}/src" />
+        </classpath>
     </java>
     <touch file="${generated.timestamp}" />
   </target>
@@ -39,5 +52,9 @@
   </target>
 
   <target name="precompile" depends="generate"/>
+  
+  <target name="clean">
+  	<delete dir="${generated.path}" />
+  </target>
 
 </project>