Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"protobuf-php/google-protobuf-proto" : ">=0.1",
"zendframework/zend-code" : "^2.6",
"psr/log" : "^1.0",
"symfony/console" : "^2.5|^3.0",
"symfony/process" : "^2.5|^3.0",
"symfony/console" : "^2.5|^3.0|^4.0",
"symfony/process" : "^2.5|^3.0|^4.0",
"doctrine/inflector" : "^1.0"
},
"require-dev": {
Expand Down
20 changes: 11 additions & 9 deletions src/Protoc/ProcessBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use InvalidArgumentException;
use UnexpectedValueException;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\ProcessBuilder as SymfonyProcessBuilder;

/**
* Protoc Process Builder
Expand Down Expand Up @@ -115,21 +114,22 @@ public function createProcess($outPath, array $protosFiles, array $includeDirs,
throw new InvalidArgumentException('Proto file list cannot be empty.');
}

$builder = new SymfonyProcessBuilder();
$outDir = $this->getRealPath($outPath);
$include = $this->getRealPaths($includeDirs);
$protos = $this->getRealPaths($protosFiles, true);

$builder->setPrefix($this->protoc);
$commandLine = "";

$builder->add(sprintf('--plugin=protoc-gen-php=%s', $this->plugin));
$commandLine .= $this->protoc;

$commandLine .= " ".sprintf('--plugin=protoc-gen-php=%s', $this->plugin);

foreach ($include as $i) {
$builder->add(sprintf('--proto_path=%s', $i));
$commandLine .= " ".sprintf('--proto_path=%s', $i);
}

if ($this->includeDescriptors) {
$builder->add(sprintf('--proto_path=%s', $this->findDescriptorsPath()));
$commandLine .= " ".sprintf('--proto_path=%s', $this->findDescriptorsPath());
}

// Protoc will pass custom arguments to the plugin if they are given
Expand All @@ -138,14 +138,16 @@ public function createProcess($outPath, array $protosFiles, array $includeDirs,
? http_build_query($parameters, '', '&') . ':' . $outDir
: $outDir;

$builder->add(sprintf('--php_out=%s', $out));
$commandLine .= " ".sprintf('--php_out=%s', $out);

// Add the chosen proto files to generate
foreach ($protos as $proto) {
$builder->add($proto);
$commandLine .= " ".$proto;
}

return $builder->getProcess();
$builder = new Process($commandLine);

return $builder;
}

/**
Expand Down