Merge pull request #22871 from jagobagascon/feature/add-autogenerated-header-to-objc-files

objc: add autogenerated header to generated files
pull/22949/head
Stanley Cheung 5 years ago committed by GitHub
commit f9726aefc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      src/compiler/objective_c_plugin.cc

@ -127,6 +127,12 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
}
}
// Write out a file header.
::grpc::string file_header =
"// Code generated by gRPC proto compiler. DO NOT EDIT!\n"
"// source: " +
file->name() + "\n\n";
{
// Generate .pbrpc.h
@ -187,7 +193,7 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
}
Write(context, file_name + ".pbrpc.h",
PreprocIfNot(kForwardDeclare, imports) + "\n" +
file_header + PreprocIfNot(kForwardDeclare, imports) + "\n" +
PreprocIfNot(kProtocolOnly, system_imports) + "\n" +
class_declarations + "\n" +
PreprocIfNot(kForwardDeclare, class_imports) + "\n" +
@ -228,8 +234,9 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
}
Write(context, file_name + ".pbrpc.m",
PreprocIfNot(kProtocolOnly,
imports + "\n" + class_imports + "\n" + definitions));
file_header +
PreprocIfNot(kProtocolOnly, imports + "\n" + class_imports +
"\n" + definitions));
}
return true;

Loading…
Cancel
Save