aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-11-17 23:11:13 +0800
committerGravatar Muxi Yan <mxyan@google.com>2017-11-17 23:31:09 +0800
commit9b7484867663018e2b362cf01567dd9a77341f00 (patch)
tree7a8236b237575af35922a6ee094c5ee7ba9b4034 /src/compiler
parentf6d4008c5f58d5c219b6b3bf96d75cb70ec263ac (diff)
forward declare pbobjc.h
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/objective_c_plugin.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc
index 53ff81f94a..d5d488e84d 100644
--- a/src/compiler/objective_c_plugin.cc
+++ b/src/compiler/objective_c_plugin.cc
@@ -51,12 +51,15 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
{
// Generate .pbrpc.h
- ::grpc::string imports = ::grpc::string("#import \"") + file_name +
- ".pbobjc.h\"\n\n"
- "#import <ProtoRPC/ProtoService.h>\n"
- "#import <ProtoRPC/ProtoRPC.h>\n"
- "#import <RxLibrary/GRXWriteable.h>\n"
- "#import <RxLibrary/GRXWriter.h>\n";
+ ::grpc::string imports =
+ ::grpc::string("#if !GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO\n") +
+ "#import \"" + file_name +
+ ".pbobjc.h\"\n"
+ "#endif\n\n"
+ "#import <ProtoRPC/ProtoService.h>\n"
+ "#import <ProtoRPC/ProtoRPC.h>\n"
+ "#import <RxLibrary/GRXWriteable.h>\n"
+ "#import <RxLibrary/GRXWriter.h>\n";
::grpc::string proto_imports;
proto_imports += "#if GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO\n" +
@@ -105,7 +108,10 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
// Generate .pbrpc.m
::grpc::string imports = ::grpc::string("#import \"") + file_name +
- ".pbrpc.h\"\n\n"
+ ".pbrpc.h\"\n"
+ "#import \"" +
+ file_name +
+ ".pbobjc.h\"\n\n"
"#import <ProtoRPC/ProtoRPC.h>\n"
"#import <RxLibrary/GRXWriter+Immediate.h>\n";
for (int i = 0; i < file->dependency_count(); i++) {