Skip to content

Commit

Permalink
Closes #1520
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay committed Nov 18, 2018
1 parent 66bbcc4 commit 1abfdc0
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 32 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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
37 changes: 19 additions & 18 deletions Library/Command/BuildCommand.php
Expand Up @@ -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(
<<<EOT
Generates/Compiles/Installs a Zephir extension.
Just a meta command that just calls "generate", "compile" and "install" commands.
Using "--dev" option will force compile and install the extension in development mode
(debug symbols and no optimizations). An extension compiled with debugging symbols means
you can run a program or library through a debugger and the debugger's output will be user
friendlier. These debugging symbols also enlarge the program or library significantly.
EOT
);
->addOption('dev', null, InputOption::VALUE_NONE, 'Build the extension in development mode')
->setHelp($this->getBuildDevHelp());
}

protected function execute(InputInterface $input, OutputInterface $output)
Expand All @@ -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 <<<EOT
Generates/Compiles/Installs a Zephir extension.
Just a meta command that just calls "generate", "compile" and "install" commands.
Using "--dev" option will force building and install the extension in development mode
(debug symbols and no optimizations). An extension compiled with debugging symbols means
you can run a program or library through a debugger and the debugger's output will be user
friendlier. These debugging symbols also enlarge the program or library significantly.
Note: Zephir development mode will be enabled silently if your PHP binary was compiled in
a debug configuration.
EOT;
}
}
25 changes: 18 additions & 7 deletions Library/Command/CompileCommand.php
Expand Up @@ -36,12 +36,8 @@ protected function configure()
'Used backend to compile extension',
'ZendEngine3'
)
->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)
Expand All @@ -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 <<<EOT
Compile a Zephir extension.
Using "--dev" option will force compiling the extension in development mode
(debug symbols and no optimizations). An extension compiled with debugging symbols means
you can run a program or library through a debugger and the debugger's output will be user
friendlier. These debugging symbols also enlarge the program or library significantly.
Note: Zephir development mode will be enabled silently if your PHP binary was compiled in
a debug configuration.
EOT;
}
}
26 changes: 19 additions & 7 deletions Library/Command/InstallCommand.php
Expand Up @@ -29,19 +29,31 @@ protected function configure()
$this
->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 <<<EOT
Installs the extension in the extension directory.
Note: The command may require root password on Linux/Unit systems.
Using "--dev" option will try installing the extension in development mode
(debug symbols and no optimizations). An extension compiled with debugging symbols means
you can run a program or library through a debugger and the debugger's output will be user
friendlier. These debugging symbols also enlarge the program or library significantly.
Note: Zephir development mode will be enabled silently if your PHP binary was compiled in
a debug configuration.
EOT;
}
}

0 comments on commit 1abfdc0

Please sign in to comment.