diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index e01b496ed69..d66811d7d28 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -98,8 +98,8 @@ bool HasBidiStreaming(const google::protobuf::FileDescriptor* file) { string GetHeaderIncludes(const google::protobuf::FileDescriptor* file) { string temp = - "#include \"net/grpc/cpp/internal/client/internal_stub.h\"\n" - "#include \"net/grpc/cpp/public/status.h\"\n" + "#include \"src/cpp/client/internal_stub.h\"\n" + "#include \"grpc++/status.h\"\n" "\n" "namespace grpc {\n" "class ChannelInterface;\n" @@ -125,10 +125,10 @@ string GetHeaderIncludes(const google::protobuf::FileDescriptor* file) { } string GetSourceIncludes() { - return "#include \"net/grpc/cpp/internal/rpc_method.h\"\n" - "#include \"net/grpc/cpp/internal/server/rpc_service_method.h\"\n" - "#include \"net/grpc/cpp/public/channel_interface.h\"\n" - "#include \"net/grpc/cpp/public/stream.h\"\n"; + return "#include \"src/cpp/rpc_method.h\"\n" + "#include \"src/cpp/server/rpc_service_method.h\"\n" + "#include \"grpc++/channel_interface.h\"\n" + "#include \"grpc++/stream.h\"\n"; } void PrintHeaderClientMethod(google::protobuf::io::Printer* printer, diff --git a/src/compiler/ruby_generator_string-inl.h b/src/compiler/ruby_generator_string-inl.h index 205d2e16f0a..f9c377d9bc6 100644 --- a/src/compiler/ruby_generator_string-inl.h +++ b/src/compiler/ruby_generator_string-inl.h @@ -93,14 +93,6 @@ inline bool ReplacePrefix(string* s, const string& from, const string& to) { return true; } -// RubyTypeOf updates a proto type to the required ruby equivalent. -inline string RubyTypeOf(const string& a_type, const string& package) { - string res(a_type); - ReplacePrefix(&res, package, ""); // remove the leading package if present - ReplacePrefix(&res, ".", ""); // remove the leading . (no package) - return ReplaceAll(res, ".", "::"); // switch '.' to the ruby module delimiter -} - // CapitalizeString capitalizes a string. inline string CapitalizeString(string s) { if (!s.empty()) { @@ -111,6 +103,29 @@ inline string CapitalizeString(string s) { return s; } +// RubyTypeOf updates a proto type to the required ruby equivalent. +inline string RubyTypeOf(const string& a_type, const string& package) { + string res(a_type); + ReplacePrefix(&res, package, ""); // remove the leading package if present + ReplacePrefix(&res, ".", ""); // remove the leading . (no package) + if (res.find('.') == string::npos) { + return res; + } else { + vector prefixes_and_type = Split(res, '.'); + for (int i = 0; i < prefixes_and_type.size(); ++i) { + if (i != 0) { + res += "::"; // switch '.' to the ruby module delim + } + if (i < prefixes_and_type.size() - 1) { + res += CapitalizeString(prefixes_and_type[i]); // capitalize pkgs + } else { + res += prefixes_and_type[i]; + } + } + return res; + } +} + } // namespace grpc_ruby_generator #endif // NET_GRPC_COMPILER_RUBY_GENERATOR_STRING_INL_H_ diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index a3668d35222..987200f5c45 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -95,8 +95,8 @@ void DoEmpty(std::shared_ptr channel) { gpr_log(GPR_INFO, "Sending an empty rpc..."); std::unique_ptr stub(TestService::NewStub(channel)); - google::protobuf::Empty request = google::protobuf::Empty::default_instance(); - google::protobuf::Empty response = google::protobuf::Empty::default_instance(); + grpc::testing::Empty request = grpc::testing::Empty::default_instance(); + grpc::testing::Empty response = grpc::testing::Empty::default_instance(); ClientContext context; grpc::Status s = stub->EmptyCall(&context, request, &response); diff --git a/test/cpp/interop/test.proto b/test/cpp/interop/test.proto index e2886c688a6..e9c1381b41e 100644 --- a/test/cpp/interop/test.proto +++ b/test/cpp/interop/test.proto @@ -2,8 +2,8 @@ // of unary/streaming requests/responses. syntax = "proto2"; -import "net/grpc/cpp/test/interop/empty.proto"; -import "net/grpc/cpp/test/interop/messages.proto"; +import "test/cpp/interop/empty.proto"; +import "test/cpp/interop/messages.proto"; package grpc.testing;