Skip to content

Commit

Permalink
Merge pull request #2184 from zephir-lang/development
Browse files Browse the repository at this point in the history
v0.13.1
  • Loading branch information
Jeckerson authored Mar 31, 2021
2 parents 99c026e + f28ff0b commit 99f0e65
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 18 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@ and this project adheres to [Semantic Versioning](http://semver.org).

## [Unreleased]

## [0.13.1] - 2021-03-31
### Added
- Added jobs `-j, --jobs` option for `zephir compile` [#2174](https://github.com/zephir-lang/zephir/issues/2174)

### Fixed
- Fixed not used arginfo for interface static method without parameters (PHP `>= 8.0` only) [#2178](https://github.com/zephir-lang/zephir/pull/2178)
- Fixed `zephir install` command [#2175](https://github.com/zephir-lang/zephir/issues/2175)

## [0.13.0] - 2021-03-25
### Added
- Added support of PHP `8.0` [#2111](https://github.com/zephir-lang/zephir/pull/2111), [#2165](https://github.com/zephir-lang/zephir/pull/2165)

### Changed
- Dropped support of PHP `<= 7.4` versions [#2111](https://github.com/zephir-lang/zephir/pull/2111)
- Dropped support of PHP `< 7.4` versions [#2111](https://github.com/zephir-lang/zephir/pull/2111)
- Removed call of `generate` command inside `compile` call [#2150](https://github.com/zephir-lang/zephir/pull/2150)
- Removed call of `compile` command inside `install` call [#2150](https://github.com/zephir-lang/zephir/pull/2150)

Expand Down Expand Up @@ -439,7 +447,8 @@ and this project adheres to [Semantic Versioning](http://semver.org).
- Fixed casting resource to int (only ZendEngine 3)
[#1524](https://github.com/zephir-lang/zephir/issues/1524)

[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.13.0...HEAD
[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.13.1...HEAD
[0.13.1]: https://github.com/zephir-lang/zephir/compare/0.13.0...0.13.1
[0.13.0]: https://github.com/zephir-lang/zephir/compare/0.12.21...0.13.0
[0.12.21]: https://github.com/zephir-lang/zephir/compare/0.12.20...0.12.21
[0.12.20]: https://github.com/zephir-lang/zephir/compare/0.12.19...0.12.20
Expand Down
10 changes: 10 additions & 0 deletions Library/ClassDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -1414,12 +1414,22 @@ public function compile(CompilationContext $compilationContext): void
)
);
} else {
$codePrinter->output('#if PHP_VERSION_ID >= 80000');
$codePrinter->output(
sprintf(
"\tZEND_FENTRY(%s, NULL, %s, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)",
$method->getName(),
$method->getArgInfoName($this)
)
);
$codePrinter->output('#else');
$codePrinter->output(
sprintf(
"\tZEND_FENTRY(%s, NULL, NULL, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)",
$method->getName()
)
);
$codePrinter->output('#endif');
}
} else {
$isInterface = $method->getClassDefinition()->isInterface();
Expand Down
34 changes: 19 additions & 15 deletions Library/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -818,11 +818,14 @@ public function generate(bool $fromGenerate = false): bool
* Compiles the extension without installing it.
*
* @param bool $development
* @param int|null $jobs
*
* @throws CompilerException|Exception
* @throws Exception
*/
public function compile(bool $development = false): void
public function compile(bool $development = false, ?int $jobs = null): void
{
$jobs = $jobs ?: 2;

/**
* Get global namespace.
*/
Expand All @@ -832,6 +835,19 @@ public function compile(bool $development = false): void
$extensionName = $namespace;
}

$currentDir = getcwd();
if (file_exists("{$currentDir}/compile.log")) {
unlink("{$currentDir}/compile.log");
}

if (file_exists("{$currentDir}/compile-errors.log")) {
unlink("{$currentDir}/compile-errors.log");
}

if (file_exists("{$currentDir}/ext/modules/{$namespace}.so")) {
unlink("{$currentDir}/ext/modules/{$namespace}.so");
}

if (is_windows()) {
// TODO(klay): Make this better. Looks like it is non standard Env. Var
exec('cd ext && %PHP_DEVPACK%\\phpize --clean', $output, $exit);
Expand Down Expand Up @@ -907,7 +923,7 @@ public function compile(bool $development = false): void
} else {
$this->preCompileHeaders();
exec(
'cd ext && (make -s -j2 2>'.$currentDir.'/compile-errors.log 1>'.
'cd ext && (make -s -j'.$jobs.' 2>'.$currentDir.'/compile-errors.log 1>'.
$currentDir.
'/compile.log)',
$output,
Expand Down Expand Up @@ -995,18 +1011,6 @@ public function install(bool $development = false): void
throw new NotImplementedException('Installation is not implemented for Windows yet. Aborting.');
}

if (file_exists("{$currentDir}/compile.log")) {
unlink("{$currentDir}/compile.log");
}

if (file_exists("{$currentDir}/compile-errors.log")) {
unlink("{$currentDir}/compile-errors.log");
}

if (file_exists("{$currentDir}/ext/modules/{$namespace}.so")) {
unlink("{$currentDir}/ext/modules/{$namespace}.so");
}

$this->logger->info('Installing...');
$gccFlags = $this->getGccFlags($development);

Expand Down
6 changes: 5 additions & 1 deletion Library/Console/Command/CompileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,21 @@ protected function configure()
->setDefinition($this->createDefinition())
->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')
->addOption('jobs', 'j', InputOption::VALUE_REQUIRED, 'Set make -j (job slots)')
->setHelp($this->getDevelopmentModeHelp().PHP_EOL.$this->getZflagsHelp());
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);

$jobs = $input->hasOption('jobs') ? (int)$input->getOption('jobs') : null;

try {
// TODO: Move all the stuff from the compiler
$this->compiler->compile(
$this->isDevelopmentModeEnabled($input)
$this->isDevelopmentModeEnabled($input),
$jobs
);
} catch (CompilerException $e) {
$io->getErrorStyle()->error($e->getMessage());
Expand Down
6 changes: 6 additions & 0 deletions stub/interfaces/interfacestaticmethod.zep
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Stub\Interfaces;

interface InterfaceStaticMethod
{
public static function reset();
}

0 comments on commit 99f0e65

Please sign in to comment.