From d4d9982343525bab75e080a7344dcf9c3f73f158 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 26 Mar 2021 11:05:26 +0000 Subject: [PATCH 1/8] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a0f41411..bab604ac1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org). - 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) From 2ebefb32c0dd130a73e03f184cbdcd52a23e439a Mon Sep 17 00:00:00 2001 From: Mikhail Snetkov Date: Mon, 29 Mar 2021 10:53:03 +0700 Subject: [PATCH 2/8] Fix arginfo for interface static method without parameters --- Library/ClassDefinition.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Library/ClassDefinition.php b/Library/ClassDefinition.php index b01ff67c0..db75f5e97 100644 --- a/Library/ClassDefinition.php +++ b/Library/ClassDefinition.php @@ -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(); From 15774a1e27bca026dd0ae17526d292e2b1f4fbcc Mon Sep 17 00:00:00 2001 From: Mikhail Snetkov Date: Mon, 29 Mar 2021 15:29:32 +0700 Subject: [PATCH 3/8] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bab604ac1..a80d68cde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format based on [Keep a Changelog](http://keepachangelog.com) and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased] +### Fixed +- Fixed not used arginfo for interface static method without parameters (PHP `>= 8.0` only) [#2178](https://github.com/zephir-lang/zephir/pull/2178) ## [0.13.0] - 2021-03-25 ### Added From f47836b4363211343adf72a02ec30070d1b29d9d Mon Sep 17 00:00:00 2001 From: Mikhail Snetkov Date: Mon, 29 Mar 2021 15:32:58 +0700 Subject: [PATCH 4/8] Add test case Stub\Interfaces\InterfaceStaticMethod --- stub/interfaces/interfacestaticmethod.zep | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 stub/interfaces/interfacestaticmethod.zep diff --git a/stub/interfaces/interfacestaticmethod.zep b/stub/interfaces/interfacestaticmethod.zep new file mode 100644 index 000000000..3e63ca374 --- /dev/null +++ b/stub/interfaces/interfacestaticmethod.zep @@ -0,0 +1,6 @@ +namespace Stub\Interfaces; + +interface InterfaceStaticMethod +{ + public static function reset(); +} From 88106f389c0f19b8c0b4f74a737536e2e257b232 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 30 Mar 2021 23:42:20 +0100 Subject: [PATCH 5/8] #2175 - Move files check from install() to compile() --- Library/Compiler.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Library/Compiler.php b/Library/Compiler.php index b3af0c34d..0dbc2e3f6 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -832,6 +832,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); @@ -995,18 +1008,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); From 45498d199b3516cc40eb14fe3cadd79bcd5c9235 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 30 Mar 2021 23:42:49 +0100 Subject: [PATCH 6/8] #2175 - Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a80d68cde..caec076b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased] ### 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 From 06358795b2310aa663c327afba998433950c51d0 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Wed, 31 Mar 2021 00:09:31 +0100 Subject: [PATCH 7/8] #2174 - Add --jobs option to compile command --- CHANGELOG.md | 3 +++ Library/Compiler.php | 9 ++++++--- Library/Console/Command/CompileCommand.php | 6 +++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a80d68cde..56c39b085 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format based on [Keep a Changelog](http://keepachangelog.com) and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased] +### 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) diff --git a/Library/Compiler.php b/Library/Compiler.php index 0dbc2e3f6..2648f0453 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -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. */ @@ -920,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, diff --git a/Library/Console/Command/CompileCommand.php b/Library/Console/Command/CompileCommand.php index ff0be65bd..4914dfaf4 100644 --- a/Library/Console/Command/CompileCommand.php +++ b/Library/Console/Command/CompileCommand.php @@ -48,6 +48,7 @@ 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()); } @@ -55,10 +56,13 @@ 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()); From f28ff0bc49387e5a1c0dee9288615bb2e38a34ce Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Wed, 31 Mar 2021 20:01:10 +0100 Subject: [PATCH 8/8] Add 0.13.1 to CHANGELOG.md --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e2efef2d..6df0012b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format based on [Keep a Changelog](http://keepachangelog.com) 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) @@ -445,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