Backward compatibility

pull/11341/head
Muxi Yan 8 years ago
parent 88d9377365
commit c4f84819bd
  1. 8
      src/compiler/objective_c_generator_helpers.h
  2. 14
      src/compiler/objective_c_plugin.cc

@ -46,8 +46,12 @@ using ::grpc::protobuf::FileDescriptor;
using ::grpc::protobuf::ServiceDescriptor;
using ::grpc::string;
inline string MessageHeaderName(const FileDescriptor *file) {
return google::protobuf::compiler::objectivec::FilePath(file) + ".pbobjc.h";
inline string MessageHeaderName(const FileDescriptor *file, bool dash_as_separator) {
if (dash_as_separator) {
return google::protobuf::compiler::objectivec::FilePath(file) + ".pbobjc.h";
} else {
return grpc_generator::FileNameInUpperCamel(file) + ".pbobjc.h";
}
}
inline string ServiceClassName(const ServiceDescriptor *service) {

@ -59,8 +59,16 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
return true;
}
::grpc::string file_name =
google::protobuf::compiler::objectivec::FilePath(file);
::grpc::string file_name;
// Simple parameter parsing as we have only one parameter.
// TODO(mxyan): Complete parameter parsing.
bool dash_as_separator = (0 == parameter.compare("--filename-dash-as-separator"));
if (dash_as_separator) {
file_name = google::protobuf::compiler::objectivec::FilePath(file);
} else {
file_name = grpc_generator::FileNameInUpperCamel(file);
}
::grpc::string prefix = file->options().objc_class_prefix();
{
@ -78,7 +86,7 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
::grpc::string proto_imports;
for (int i = 0; i < file->dependency_count(); i++) {
::grpc::string header =
grpc_objective_c_generator::MessageHeaderName(file->dependency(i));
grpc_objective_c_generator::MessageHeaderName(file->dependency(i), dash_as_separator);
const grpc::protobuf::FileDescriptor *dependency = file->dependency(i);
if (IsProtobufLibraryBundledProtoFile(dependency)) {
::grpc::string base_name = header;

Loading…
Cancel
Save