Reviewers: kenton,

Description:
In C++, writing a code generator plugin is as easy as implementing
CodeGenerator and passing an instance to
google::protobuf::compiler::PluginMain; it shouldn't be any harder in
Java (or Python BTW).

This patch adds a JavaHelpers class which is just a port of
google/protobuf/compiler/java/java_helpers.{h,cc} with a few additional
helper methods; and the abstract Plugin class.

To implement a protoc plugin in Java, simply write an implementation of
Plugin, then create a main() method like:
  public static void main(String[] args) {
    new MyPlugin().run(args);
  }

The main difference with C++ is that the Java code needs to be launched
from a shell/batch script (the patch includes a sample batch file for
Windows), and expects that the name of the script be passed as the first
command-line argument.

The code currently lacks JavaDoc and unit tests but I'm providing it
here for an early review.

Please review this at http://codereview.appspot.com/912042/show

Affected files:
  java/protoc-gen-plugin.bat.tmpl
  java/src/main/java/com/google/protobuf/compiler/JavaHelpers.java
  java/src/main/java/com/google/protobuf/compiler/Plugin.java
  src/google/protobuf/compiler/plugin.proto


--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to