From 5ce69e991a00a5a0c5016bffd150ce0abbf84e1b Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Fri, 12 Dec 2014 17:31:25 -0800 Subject: Support Ruby code generation only for proto3. --- src/google/protobuf/compiler/ruby/ruby_generator.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/google/protobuf/compiler/ruby/ruby_generator.cc') 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 output(generator_context->Open(filename)); -- cgit v1.2.3