activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r745108 [2/2] - in /activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf: ./ compiler/
Date Tue, 17 Feb 2009 14:49:53 GMT
Modified: activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/JavaGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/JavaGenerator.java?rev=745108&r1=745107&r2=745108&view=diff
==============================================================================
--- activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/JavaGenerator.java
(original)
+++ activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/JavaGenerator.java
Tue Feb 17 14:49:52 2009
@@ -31,7 +31,6 @@
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
 
@@ -80,18 +79,6 @@
 
     }
 
-    static public class CompilerException extends Exception {
-        private final List<String> errors;
-
-        public CompilerException(List<String> errors) {
-            this.errors = errors;
-        }
-
-        public List<String> getErrors() {
-            return errors;
-        }
-    }
-
     interface Closure {
         void execute() throws CompilerException;
     }

Modified: activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/ProtoMojo.java
URL: http://svn.apache.org/viewvc/activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/ProtoMojo.java?rev=745108&r1=745107&r2=745108&view=diff
==============================================================================
--- activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/ProtoMojo.java
(original)
+++ activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/ProtoMojo.java
Tue Feb 17 14:49:52 2009
@@ -23,7 +23,6 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.activemq.protobuf.compiler.JavaGenerator.CompilerException;
 import org.apache.activemq.protobuf.compiler.parser.ParseException;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -61,6 +60,14 @@
      */
     private File outputDirectory;
 
+    
+    /**
+     * The type of generator to run.
+     * 
+     * @parameter default-value="default"
+     */
+    private String type;
+
     public void execute() throws MojoExecutionException {
 
         File[] files = sourceDirectory.listFiles(new FileFilter() {
@@ -78,9 +85,15 @@
         for (File file : recFiles) {
             try {
                 getLog().info("Compiling: "+file.getPath());
-                JavaGenerator generator = new JavaGenerator();
-                generator.setOut(outputDirectory);
-                generator.compile(file);
+                if( "default".equals(type) ) {
+                    JavaGenerator generator = new JavaGenerator();
+                    generator.setOut(outputDirectory);
+                    generator.compile(file);
+                } else if( "alt".equals(type) ) {
+                    AltJavaGenerator generator = new AltJavaGenerator();
+                    generator.setOut(outputDirectory);
+                    generator.compile(file);
+                }
             } catch (CompilerException e) {
                 getLog().error("Protocol Buffer Compiler failed with the following error(s):");
                 for (String error : e.getErrors() ) {



Mime
View raw message