Infrastructure for loading code generators a bit more dynamically.
authorDavid Reiss <dreiss@apache.org>
Wed, 27 Feb 2008 01:54:51 +0000 (01:54 +0000)
committerDavid Reiss <dreiss@apache.org>
Wed, 27 Feb 2008 01:54:51 +0000 (01:54 +0000)
commitbd0db88477f02c67962c638c8dfb5f2bb6619144
tree78d7a68eed551cfa2220b0e025d326ae377bc578
parent9cc2c137102ce4b5a2e0d362832ea1021c20ca19
Infrastructure for loading code generators a bit more dynamically.

Add a generic and easy-to-use mechanism for Thrift code generators to
register themselves centrally.  The central registry is used to
obtain documentation for the options accepted by individual generators
and get instances of individual generators.  It also does a little bit of
option parsing that will be useful for all generators.

Obviously, this change cannot be tested on its own.  I can only say
that Thrift still builds and runs correctly.  Subsequent changes
will apply this infrastructure to specific code generators.
Steve Grimm has assured me that this is standard Git practice.

In fact, I ran this test after converting the C++ and Java generators:

dreiss@dreiss-vmware:dynamic_generators:thrift/test$ mkdir old new
dreiss@dreiss-vmware:dynamic_generators:thrift/test$ cd old
dreiss@dreiss-vmware:dynamic_generators:thrift/test/old$ ../../compiler/cpp/thrift -cpp -dense -java -javabean ../DebugProtoTest.thrift
[WARNING::1] -cpp is deprecated.  Use --gen cpp
[WARNING::1] -java is deprecated.  Use --gen java
[WARNING::1] -javabean is deprecated.  Use --gen java:beans
dreiss@dreiss-vmware:dynamic_generators:thrift/test/old$ cd ../new/
dreiss@dreiss-vmware:dynamic_generators:thrift/test/new$ ../../compiler/cpp/thrift --gen cpp:dense --gen java --gen java:beans ../DebugProtoTest.thrift
dreiss@dreiss-vmware:dynamic_generators:thrift/test/new$ cd ..
dreiss@dreiss-vmware:dynamic_generators:thrift/test$ diff -ur old/ new/
dreiss@dreiss-vmware:dynamic_generators:thrift/test$

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665507 13f79535-47bb-0310-9956-ffa450edef68
compiler/cpp/src/generate/t_generator.cc
compiler/cpp/src/generate/t_generator.h
compiler/cpp/src/main.cc