Skip to content
This repository was archived by the owner on May 29, 2018. It is now read-only.

Commit 9bb9bb9

Browse files
author
Christopher Burnett
committed
prevent protoc errors by skipping previously gen'd files
1 parent edb5700 commit 9bb9bb9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/protoc-gen-php.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include <google/protobuf/io/zero_copy_stream.h>
4848

4949
using std::string;
50+
using namespace std;
5051

5152
using namespace google::protobuf;
5253
using namespace google::protobuf::compiler;
@@ -71,6 +72,8 @@ bool PHPCodeGenerator::Generate(const FileDescriptor* file,
7172
assert(file != NULL);
7273
assert(context != NULL);
7374

75+
map<string, bool> descriptor_map;
76+
7477
string php_filename = FileDescriptorToPath(*file);
7578
cerr << "Generating " << php_filename << endl;
7679

@@ -85,8 +88,11 @@ bool PHPCodeGenerator::Generate(const FileDescriptor* file,
8588
main.Generate(error);
8689

8790
for (int i = 0; i < file->dependency_count(); i++) {
88-
// TODO Check if we have processed this file already (due to imports), and
89-
// if so skip
91+
if (descriptor_map.find(file->name()) == descriptor_map.end()) {
92+
continue;
93+
}
94+
95+
descriptor_map[file->name()] = true;
9096
// TODO Keep track of this in the PHPCodeGenerator
9197
if (!Generate(file->dependency(i), parameter, context, error)) {
9298
return false;

0 commit comments

Comments
 (0)