aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler
diff options
context:
space:
mode:
authorGravatar Nick Gordon <nicholas.gordon@wework.com>2018-07-16 10:11:56 -0700
committerGravatar Nick Gordon <nicholas.gordon@wework.com>2018-09-14 11:28:24 -0400
commit3fe2c98877f376cc0c8d7da61d6e63eca83f4bec (patch)
tree85a44e70b35bebdfbae18465b410b1f82d6931c6 /src/compiler
parent608188c680961b8506847c135b5170b41a9081e8 (diff)
Updates to the ruby generator for protobuf 3.6.0 changes
test for verifying the ruby_package option added WeWork to the AUTHORS file
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/ruby_generator.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/compiler/ruby_generator.cc b/src/compiler/ruby_generator.cc
index c7af9c38fa..e39d8be5d4 100644
--- a/src/compiler/ruby_generator.cc
+++ b/src/compiler/ruby_generator.cc
@@ -160,12 +160,20 @@ grpc::string GetServices(const FileDescriptor* file) {
return output;
}
+ std::string package_name;
+
+ if (file->options().has_ruby_package()) {
+ package_name = file->options().ruby_package();
+ } else {
+ package_name = file->package();
+ }
+
// Write out a file header.
std::map<grpc::string, grpc::string> header_comment_vars = ListToDict({
"file.name",
file->name(),
"file.package",
- file->package(),
+ package_name,
});
out.Print("# Generated by the protocol buffer compiler. DO NOT EDIT!\n");
out.Print(header_comment_vars,
@@ -190,7 +198,7 @@ grpc::string GetServices(const FileDescriptor* file) {
// Write out services within the modules
out.Print("\n");
- std::vector<grpc::string> modules = Split(file->package(), '.');
+ std::vector<grpc::string> modules = Split(package_name, '.');
for (size_t i = 0; i < modules.size(); ++i) {
std::map<grpc::string, grpc::string> module_vars = ListToDict({
"module.name",