Commit 0c011c4c authored by Jisi Liu's avatar Jisi Liu Committed by GitHub

Merge pull request #1793 from pherl/javalite

Add a javalite plugin.
parents 10a8fb4e b702a16f
......@@ -472,9 +472,11 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/csharp/csharp_wrapper_field.cc \
google/protobuf/compiler/csharp/csharp_wrapper_field.h
bin_PROGRAMS = protoc
bin_PROGRAMS = protoc protoc-gen-javalite
protoc_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la
protoc_SOURCES = google/protobuf/compiler/main.cc
protoc_gen_javalite_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la
protoc_gen_javalite_SOURCES = google/protobuf/compiler/java/java_lite_main.cc
# Tests ==============================================================
......@@ -677,6 +679,7 @@ COMMON_TEST_SOURCES = \
check_PROGRAMS = protoc protobuf-test protobuf-lazy-descriptor-test \
protobuf-lite-test test_plugin protobuf-lite-arena-test \
protoc-gen-javalite \
$(GZCHECKPROGRAMS)
protobuf_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \
../gmock/gtest/lib/libgtest.la \
......
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/java/java_generator.h>
#include <google/protobuf/compiler/plugin.h>
namespace google {
namespace protobuf {
namespace compiler {
namespace java {
class JavaLiteGenerator : public CodeGenerator {
public:
JavaLiteGenerator() {}
~JavaLiteGenerator() {}
bool Generate(const FileDescriptor* file,
const string& parameter,
GeneratorContext* context,
string* error) const {
// Only pass 'lite' as the generator parameter.
return generator_.Generate(file, "lite", context, error);
}
private:
JavaGenerator generator_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaLiteGenerator);
};
} // namespace java
} // namespace compiler
} // namespace protobuf
} // namespace google
int main(int argc, char* argv[]) {
google::protobuf::compiler::java::JavaLiteGenerator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment