drslump / Protobuf-PHP

PHP implementation of Google's Protocol Buffers with a protoc plugin compiler
http://drslump.github.com/Protobuf-PHP/
MIT License
462 stars 163 forks source link

Only imported files are generated even with skip imported option #33

Open dstevenson opened 10 years ago

dstevenson commented 10 years ago

I have branched off of the lazy branch and I am unable to generate files that have imports in them (e.g. plugin.proto)

Can you advise if you are experiencing this issue or where I should look?

Inside Compiler.php

        // Get the list of files to generate
        $files = $req->getFileToGenerate();

        // Run each file
        foreach ($req->proto_file as $file) {
            // Only compile those given to generate, not the imported ones
            if ($this->skipImported && !in_array($file->getName(), $files)) {
                $this->notice('Skipping generation of imported file "' . $file->getName() . '"');
                continue;
            }

            $this->notice("FILE {$file->getName()}");
            $sources = $generator->generate($file);
            foreach ($sources as $source) {
                $this->notice('Generating "' . $source->getName() . '"');
                $resp->addFile($source);
            }
        }

result of files is correct.

$req->proto_file only returns file listed as import