diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2014-12-12 22:10:03 -0800 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2014-12-12 22:10:03 -0800 |
commit | 59692c3fc080645fdc6e8d2445f04a1d65cee48c (patch) | |
tree | 3023097d0228c46c0287448250e6e5c21f589925 | |
parent | 044e095a9be224a07ebec4bf9ada1de92e159816 (diff) | |
parent | 5ce69e991a00a5a0c5016bffd150ce0abbf84e1b (diff) | |
download | protobuf-59692c3fc080645fdc6e8d2445f04a1d65cee48c.tar.gz protobuf-59692c3fc080645fdc6e8d2445f04a1d65cee48c.tar.bz2 protobuf-59692c3fc080645fdc6e8d2445f04a1d65cee48c.zip |
Merge pull request #136 from cfallin/ruby-proto3-only
Support Ruby code generation only for proto3.
-rw-r--r-- | src/google/protobuf/compiler/ruby/ruby_generator.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/ruby/ruby_generator.cc b/src/google/protobuf/compiler/ruby/ruby_generator.cc index e70425ff..c5687903 100644 --- a/src/google/protobuf/compiler/ruby/ruby_generator.cc +++ b/src/google/protobuf/compiler/ruby/ruby_generator.cc @@ -297,6 +297,14 @@ bool Generator::Generate( const string& parameter, GeneratorContext* generator_context, string* error) const { + + if (file->syntax() != FileDescriptor::SYNTAX_PROTO3) { + *error = + "Can only generate Ruby code for proto3 .proto files.\n" + "Please add 'syntax = \"proto3\";' to the top of your .proto file.\n"; + return false; + } + std::string filename = StripDotProto(file->name()) + ".rb"; scoped_ptr<io::ZeroCopyOutputStream> output(generator_context->Open(filename)); |