aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler/objective_c_plugin.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/objective_c_plugin.cc')
-rw-r--r--src/compiler/objective_c_plugin.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc
index f0fe3688cc..87977095d0 100644
--- a/src/compiler/objective_c_plugin.cc
+++ b/src/compiler/objective_c_plugin.cc
@@ -93,7 +93,13 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
SystemImport("RxLibrary/GRXWriteable.h") +
SystemImport("RxLibrary/GRXWriter.h");
- ::grpc::string forward_declarations = "@class GRPCProtoCall;\n\n";
+ ::grpc::string forward_declarations =
+ "@class GRPCProtoCall;\n"
+ "@class GRPCUnaryProtoCall;\n"
+ "@class GRPCStreamingProtoCall;\n"
+ "@class GRPCCallOptions;\n"
+ "@protocol GRPCProtoResponseHandler;\n"
+ "\n";
::grpc::string class_declarations =
grpc_objective_c_generator::GetAllMessageClasses(file);
@@ -103,6 +109,12 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
class_imports += ImportProtoHeaders(file->dependency(i), " ");
}
+ ::grpc::string ng_protocols;
+ for (int i = 0; i < file->service_count(); i++) {
+ const grpc::protobuf::ServiceDescriptor* service = file->service(i);
+ ng_protocols += grpc_objective_c_generator::GetV2Protocol(service);
+ }
+
::grpc::string protocols;
for (int i = 0; i < file->service_count(); i++) {
const grpc::protobuf::ServiceDescriptor* service = file->service(i);
@@ -120,9 +132,10 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
PreprocIfNot(kProtocolOnly, system_imports) + "\n" +
class_declarations + "\n" +
PreprocIfNot(kForwardDeclare, class_imports) + "\n" +
- forward_declarations + "\n" + kNonNullBegin + "\n" + protocols +
- "\n" + PreprocIfNot(kProtocolOnly, interfaces) + "\n" +
- kNonNullEnd + "\n");
+ forward_declarations + "\n" + kNonNullBegin + "\n" +
+ ng_protocols + protocols + "\n" +
+ PreprocIfNot(kProtocolOnly, interfaces) + "\n" + kNonNullEnd +
+ "\n");
}
{