diff --git a/composer.json b/composer.json index ca9433f..9588a16 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/src/Protoc/ProcessBuilder.php b/src/Protoc/ProcessBuilder.php index a7e3bc6..cd9c0af 100644 --- a/src/Protoc/ProcessBuilder.php +++ b/src/Protoc/ProcessBuilder.php @@ -7,7 +7,6 @@ use InvalidArgumentException; use UnexpectedValueException; use Symfony\Component\Process\Process; -use Symfony\Component\Process\ProcessBuilder as SymfonyProcessBuilder; /** * Protoc Process Builder @@ -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 @@ -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; } /**