From 1abfdc0c71a8eef4d21b785806c66971ec980588 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Thu, 15 Nov 2018 16:33:25 +0200 Subject: [PATCH] Closes #1520 --- CHANGELOG.md | 2 ++ Library/Command/BuildCommand.php | 37 +++++++++++++++--------------- Library/Command/CompileCommand.php | 25 ++++++++++++++------ Library/Command/InstallCommand.php | 26 +++++++++++++++------ 4 files changed, 58 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74069ef836..becd8415bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,5 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Introduced a brand new CLI interface - The preferred method of installation is to use the Zephir PHAR which can be downloaded from the most recent Github Release +- Zephir development mode will be enabled silently if your PHP binary was compiled in + a debug configuration [#1520](https://github.com/phalcon/zephir/issues/1520) [Unreleased]: https://github.com/phalcon/zephir/compare/0.11.3...HEAD diff --git a/Library/Command/BuildCommand.php b/Library/Command/BuildCommand.php index 7d7cf449c2..58c9b0dfbf 100644 --- a/Library/Command/BuildCommand.php +++ b/Library/Command/BuildCommand.php @@ -37,23 +37,8 @@ protected function configure() 'Used backend to build extension', 'ZendEngine3' ) - ->addOption( - 'dev', - null, - InputOption::VALUE_NONE, - 'Build the extension in development mode' - ) - ->setHelp( - <<addOption('dev', null, InputOption::VALUE_NONE, 'Build the extension in development mode') + ->setHelp($this->getBuildDevHelp()); } protected function execute(InputInterface $input, OutputInterface $output) @@ -70,9 +55,25 @@ protected function execute(InputInterface $input, OutputInterface $output) $arguments = [ 'command' => 'install', '--backend' => $input->getOption('backend'), - '--dev' => $input->getOption('dev'), + '--dev' => $input->getOption('dev') || PHP_DEBUG, ]; return $command->run(new ArrayInput($arguments), $output); } + + private function getBuildDevHelp() + { + return <<addOption( - 'dev', - null, - InputOption::VALUE_NONE, - 'Compile the extension in development mode' - ); + ->addOption('dev', null, InputOption::VALUE_NONE, 'Compile the extension in development mode') + ->setHelp($this->getCompileDevHelp()); } protected function execute(InputInterface $input, OutputInterface $output) @@ -54,8 +50,23 @@ protected function execute(InputInterface $input, OutputInterface $output) */ // TODO: Move all the stuff from the compiler - $this->compiler->compile($input->getOption('dev')); + $this->compiler->compile($input->getOption('dev') || PHP_DEBUG); return 0; } + + private function getCompileDevHelp() + { + return <<setName('install') ->setDescription('Installs the extension in the extension directory (may require root password)') - ->addOption( - 'dev', - null, - InputOption::VALUE_NONE, - 'Install the extension in development mode' - ); + ->addOption('dev', null, InputOption::VALUE_NONE, 'Install the extension in development mode') + ->setHelp($this->getInstallDevHelp()); } protected function execute(InputInterface $input, OutputInterface $output) { // TODO: Move all the stuff from the compiler - $this->compiler->install($input->getOption('dev')); + $this->compiler->install($input->getOption('dev') || PHP_DEBUG); return 0; } + + private function getInstallDevHelp() + { + return <<