|
|
@ -41,6 +41,9 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h> |
|
|
|
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using ::google::protobuf::compiler::objectivec::ProtobufLibraryFrameworkName; |
|
|
|
|
|
|
|
using ::google::protobuf::compiler::objectivec::IsProtobufLibraryBundledProtoFile; |
|
|
|
|
|
|
|
|
|
|
|
class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { |
|
|
|
class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { |
|
|
|
public: |
|
|
|
public: |
|
|
|
ObjectiveCGrpcGenerator() {} |
|
|
|
ObjectiveCGrpcGenerator() {} |
|
|
@ -75,17 +78,16 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { |
|
|
|
::grpc::string header = grpc_objective_c_generator::MessageHeaderName( |
|
|
|
::grpc::string header = grpc_objective_c_generator::MessageHeaderName( |
|
|
|
file->dependency(i)); |
|
|
|
file->dependency(i)); |
|
|
|
const grpc::protobuf::FileDescriptor *dependency = file->dependency(i); |
|
|
|
const grpc::protobuf::FileDescriptor *dependency = file->dependency(i); |
|
|
|
if (::google::protobuf::compiler::objectivec::IsProtobufLibraryBundledProtoFile(dependency)) { |
|
|
|
if (IsProtobufLibraryBundledProtoFile(dependency)) { |
|
|
|
::grpc::string base_name = header; |
|
|
|
::grpc::string base_name = header; |
|
|
|
grpc_generator::StripPrefix(&base_name, "google/protobuf/"); |
|
|
|
grpc_generator::StripPrefix(&base_name, "google/protobuf/"); |
|
|
|
proto_imports += |
|
|
|
proto_imports += |
|
|
|
::grpc::string("#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS\n") + |
|
|
|
"#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS\n" |
|
|
|
::grpc::string(" #import <") + |
|
|
|
" #import <" + ::grpc::string(ProtobufLibraryFrameworkName) + |
|
|
|
::google::protobuf::compiler::objectivec::ProtobufLibraryFrameworkName + |
|
|
|
"/" + base_name + ">\n" |
|
|
|
("/") + base_name + ">\n" + |
|
|
|
"#else\n" |
|
|
|
::grpc::string("#else\n") + |
|
|
|
" #import \"" + header + "\"\n" |
|
|
|
::grpc::string(" #import \"") + header + "\"\n" + |
|
|
|
"#endif\n"; |
|
|
|
::grpc::string("#endif\n"); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
proto_imports += ::grpc::string("#import \"") + header + "\"\n"; |
|
|
|
proto_imports += ::grpc::string("#import \"") + header + "\"\n"; |
|
|
|
} |
|
|
|
} |
|
|
|