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

Commit

Permalink
prevent protoc errors by skipping previously gen'd files
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Burnett committed Dec 12, 2016
1 parent edb5700 commit 7259513
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/protoc-gen-php.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <google/protobuf/io/zero_copy_stream.h>

using std::string;
using namespace std;

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

set<string> generated_files;

string php_filename = FileDescriptorToPath(*file);
cerr << "Generating " << php_filename << endl;

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

for (int i = 0; i < file->dependency_count(); i++) {
// TODO Check if we have processed this file already (due to imports), and
// if so skip
if (generated_files.find(file->name()) == generated_files.end()) {
continue;
}

generated_files.insert(file->name());
// TODO Keep track of this in the PHPCodeGenerator
if (!Generate(file->dependency(i), parameter, context, error)) {
return false;
Expand Down

0 comments on commit 7259513

Please sign in to comment.