diff --git a/docker/Dockerfile b/docker/Dockerfile index 9b2ed1d..aa4bf4b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,7 +3,7 @@ FROM ubuntu:18.04 # Everything is not compatible with Composer 2 -COPY --from=composer:1.10.17 /usr/bin/composer /usr/local/bin/composer +COPY --from=composer:1.10.19 /usr/bin/composer /usr/local/bin/composer RUN \ # Update and instal some dependencies diff --git a/src/Command/Configure/ConfigureBenchmarkCommand.php b/src/Command/Configure/ConfigureBenchmarkCommand.php index 52874d1..5ac4ade 100644 --- a/src/Command/Configure/ConfigureBenchmarkCommand.php +++ b/src/Command/Configure/ConfigureBenchmarkCommand.php @@ -35,13 +35,25 @@ protected function configure(): void foreach ($this->configurePhpBenchmarksConfigParameters as $name => $description) { $this->addOption($name, null, InputOption::VALUE_REQUIRED, $description); } + $this->addOption( + 'php-versions', + null, + InputOption::VALUE_REQUIRED, + 'PHP version separated by "," (exemple: 7.1,7.2)' + ); } protected function doExecute(): int { + $phpCompatibleVersionsParams = []; + $phpVersions = $this->getInput()->getOption('php-versions'); + if (is_string($phpVersions)) { + $phpCompatibleVersionsParams['--php-versions'] = $phpVersions; + } + $this ->runConfigurePhpBenchmarksConfigCommand() - ->runCommand(ConfigurePhpCompatibleVersionCommand::getDefaultName()) + ->runCommand(ConfigurePhpCompatibleVersionCommand::getDefaultName(), $phpCompatibleVersionsParams) ->runCommand(ConfigureInitBenchmarkCommand::getDefaultName()) ->runCommand(ConfigureNginxVhostCommand::getDefaultName()) ->runCommand(ConfigureResponseBodyCommand::getDefaultName()) diff --git a/src/Command/Configure/Php/ConfigurePhpCompatibleVersionCommand.php b/src/Command/Configure/Php/ConfigurePhpCompatibleVersionCommand.php index e959b05..90ed905 100644 --- a/src/Command/Configure/Php/ConfigurePhpCompatibleVersionCommand.php +++ b/src/Command/Configure/Php/ConfigurePhpCompatibleVersionCommand.php @@ -11,6 +11,7 @@ PhpVersion\PhpVersionArray, Utils\Path }; +use Symfony\Component\Console\Input\InputOption; final class ConfigurePhpCompatibleVersionCommand extends AbstractCommand { @@ -23,7 +24,14 @@ protected function configure(): void { parent::configure(); - $this->setDescription('Create configuration for each compatible PHP version'); + $this + ->setDescription('Create configuration for each compatible PHP version') + ->addOption( + 'php-versions', + null, + InputOption::VALUE_REQUIRED, + 'PHP version separated by "," (exemple: 7.1,7.2)' + ); } protected function doExecute(): int @@ -55,6 +63,17 @@ protected function doExecute(): int private function getCompatiblesPhpVersions(): ?PhpVersionArray { + $phpVersions = $this->getInput()->getOption('php-versions'); + if (is_string($phpVersions)) { + $return = new PhpVersionArray(); + foreach (explode(',', $phpVersions) as $phpVersion) { + [$major, $minor] = explode('.', $phpVersion); + $return[] = new PhpVersion((int) $major, (int) $minor); + } + + return $return; + } + $composerConfiguration = $this->getComposerConfiguration(); /** @var string|null $phpVersionConfiguration */ $phpVersionConfiguration = $composerConfiguration['require']['php'] ?? null;