Skip to content

Commit

Permalink
Added --no-dev option (#1520)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay committed Nov 18, 2018
1 parent 467c577 commit 493bea0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ 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
- Added `--no-dev` option to force building the extension in production mode
[#1520](https://github.com/phalcon/zephir/issues/1520)
- 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)

Expand Down
13 changes: 11 additions & 2 deletions Library/Command/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ protected function configure()
'ZendEngine3'
)
->addOption('dev', null, InputOption::VALUE_NONE, 'Build the extension in development mode')
->addOption('no-dev', null, InputOption::VALUE_NONE, 'Build the extension in production mode')
->setHelp($this->getBuildDevHelp());
}

Expand All @@ -52,10 +53,15 @@ protected function execute(InputInterface $input, OutputInterface $output)

$command = $this->getApplication()->find('install');

$devMode = (bool) $input->getOption('no-dev');
if ($devMode == false) {
$devMode = $input->getOption('dev') || PHP_DEBUG;
}

$arguments = [
'command' => 'install',
'--backend' => $input->getOption('backend'),
'--dev' => $input->getOption('dev') || PHP_DEBUG,
'--dev' => $devMode,
];

return $command->run(new ArrayInput($arguments), $output);
Expand All @@ -67,13 +73,16 @@ private function getBuildDevHelp()
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
Using "--dev" option will force building and 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.
In some cases, we would like to get production ready extension even if the PHP binary was
compiled in a debug configuration. Use "--no-dev" option to achieve this behavior.
EOT;
}
}
11 changes: 10 additions & 1 deletion Library/Command/CompileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ protected function configure()
'ZendEngine3'
)
->addOption('dev', null, InputOption::VALUE_NONE, 'Compile the extension in development mode')
->addOption('no-dev', null, InputOption::VALUE_NONE, 'Compile the extension in production mode')
->setHelp($this->getCompileDevHelp());
}

Expand All @@ -49,8 +50,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
-W([a-z0-9\-]+) Turns a warning off
*/

$devMode = (bool) $input->getOption('no-dev');
if ($devMode == false) {
$devMode = $input->getOption('dev') || PHP_DEBUG;
}

// TODO: Move all the stuff from the compiler
$this->compiler->compile($input->getOption('dev') || PHP_DEBUG);
$this->compiler->compile($devMode);

return 0;
}
Expand All @@ -67,6 +73,9 @@ private function getCompileDevHelp()
Note: Zephir development mode will be enabled silently if your PHP binary was compiled in
a debug configuration.
In some cases, we would like to get production ready extension even if the PHP binary was
compiled in a debug configuration. Use "--no-dev" option to achieve this behavior.
EOT;
}
}
11 changes: 10 additions & 1 deletion Library/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,19 @@ protected function configure()
->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('no-dev', null, InputOption::VALUE_NONE, 'Install the extension in production mode')
->setHelp($this->getInstallDevHelp());
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$devMode = (bool) $input->getOption('no-dev');
if ($devMode == false) {
$devMode = $input->getOption('dev') || PHP_DEBUG;
}

// TODO: Move all the stuff from the compiler
$this->compiler->install($input->getOption('dev') || PHP_DEBUG);
$this->compiler->install($devMode);

return 0;
}
Expand All @@ -54,6 +60,9 @@ private function getInstallDevHelp()
Note: Zephir development mode will be enabled silently if your PHP binary was compiled in
a debug configuration.
In some cases, we would like to get production ready extension even if the PHP binary was
compiled in a debug configuration. Use "--no-dev" option to achieve this behavior.
EOT;
}
}

0 comments on commit 493bea0

Please sign in to comment.