diff options
author | Craig Tiller <ctiller@google.com> | 2017-01-31 15:54:32 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-01-31 15:54:32 -0800 |
commit | 6e0a4760c4ef38784a0b0de397481134bfd0576c (patch) | |
tree | 328ebd9aca2e4fbafbdb97f7b067848e299e1559 /src/compiler/php_plugin.cc | |
parent | 5cad46e218b3b42d5e9c10ee4e1c449b7ca23194 (diff) | |
parent | 7b005f7fddb0ce158c55bb804fe5811a096f1ae0 (diff) |
Merge github.com:grpc/grpc into version3
Diffstat (limited to 'src/compiler/php_plugin.cc')
-rw-r--r-- | src/compiler/php_plugin.cc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/compiler/php_plugin.cc b/src/compiler/php_plugin.cc index 88acad6524..00d4cd5a85 100644 --- a/src/compiler/php_plugin.cc +++ b/src/compiler/php_plugin.cc @@ -51,18 +51,22 @@ class PHPGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { const grpc::string ¶meter, grpc::protobuf::compiler::GeneratorContext *context, grpc::string *error) const { - grpc::string code = GenerateFile(file); - if (code.size() == 0) { + if (file->service_count() == 0) { return true; } - // Get output file name - grpc::string file_name = GetPHPServiceFilename(file->name()); + for (int i = 0; i < file->service_count(); i++) { + grpc::string code = GenerateFile(file, file->service(i)); + + // Get output file name + grpc::string file_name = GetPHPServiceFilename(file, file->service(i)); + + std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream> output( + context->Open(file_name)); + grpc::protobuf::io::CodedOutputStream coded_out(output.get()); + coded_out.WriteRaw(code.data(), code.size()); + } - std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream> output( - context->Open(file_name)); - grpc::protobuf::io::CodedOutputStream coded_out(output.get()); - coded_out.WriteRaw(code.data(), code.size()); return true; } }; |