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

prevent protoc errors by skipping previously gen'd files #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can get rid of the 'using std::string' above if you're importing all of 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