avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r1210708 - in /avro/trunk: ./ lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/
Date Mon, 05 Dec 2011 23:34:00 GMT
Author: cutting
Date: Mon Dec  5 23:34:00 2011
New Revision: 1210708

URL: http://svn.apache.org/viewvc?rev=1210708&view=rev
Log:
AVRO-963. Java: Permit compiler template directory to be overridden by Maven plugins.  Contributed
by George Fletcher.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
    avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/ProtocolMojo.java
    avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/SchemaMojo.java

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1210708&r1=1210707&r2=1210708&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Mon Dec  5 23:34:00 2011
@@ -8,6 +8,9 @@ Avro 1.6.2 (unreleased)
 
   IMPROVEMENTS
 
+    AVRO-963. Java: Permit compiler template directory to be
+    overridden by Maven plugins.  (George Fletcher via cutting)
+
   BUG FIXES
 
     AVRO-962. Java: Fix Maven plugin to support string type override.

Modified: avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java?rev=1210708&r1=1210707&r2=1210708&view=diff
==============================================================================
--- avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
(original)
+++ avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
Mon Dec  5 23:34:00 2011
@@ -80,6 +80,14 @@ public abstract class AbstractAvroMojo e
    */
   protected String stringType = "CharSequence";
 
+  /**
+   * The directory (within the java classpath) that contains the velocity templates
+   * to use for code generation. The default value points to the templates included
+   * with the avro-maven-plugin.
+   *
+   * @parameter expression="${templateDirectory}"
+   */
+  protected String templateDirectory = "/org/apache/avro/compiler/specific/templates/java/classic/";
 
   /**
    * The current Maven project.

Modified: avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/ProtocolMojo.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/ProtocolMojo.java?rev=1210708&r1=1210707&r2=1210708&view=diff
==============================================================================
--- avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/ProtocolMojo.java
(original)
+++ avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/ProtocolMojo.java
Mon Dec  5 23:34:00 2011
@@ -56,6 +56,7 @@ public class ProtocolMojo extends Abstra
     File src = new File(sourceDirectory, filename);
     Protocol protocol = Protocol.parse(src);
     SpecificCompiler compiler = new SpecificCompiler(protocol);
+    compiler.setTemplateDir(templateDirectory);
     compiler.setStringType(StringType.valueOf(stringType));
     compiler.compileToDestination(src, outputDirectory);
   }

Modified: avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/SchemaMojo.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/SchemaMojo.java?rev=1210708&r1=1210707&r2=1210708&view=diff
==============================================================================
--- avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/SchemaMojo.java (original)
+++ avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/SchemaMojo.java Mon
Dec  5 23:34:00 2011
@@ -57,6 +57,7 @@ public class SchemaMojo extends Abstract
     Schema.Parser parser = new Schema.Parser();
     Schema schema = parser.parse(src);
     SpecificCompiler compiler = new SpecificCompiler(schema);
+    compiler.setTemplateDir(templateDirectory);
     compiler.setStringType(StringType.valueOf(stringType));
     compiler.compileToDestination(src, outputDirectory);
   }



Mime
View raw message