From 2da750d5f9e9193adf4363f9e3e58c256c51ea83 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 18 Apr 2025 14:50:58 +0800 Subject: [PATCH] Fix phpunit, add skip extraction arg for SPCConfigUtil new builder --- src/SPC/builder/BuilderBase.php | 25 ++++++++++++++----------- src/SPC/util/SPCConfigUtil.php | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/SPC/builder/BuilderBase.php b/src/SPC/builder/BuilderBase.php index 614b223a..59f371ef 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -173,7 +173,7 @@ abstract class BuilderBase * @throws \Throwable|WrongUsageException * @internal */ - public function proveExts(array $static_extensions, array $shared_extensions = [], bool $skip_check_deps = false): void + public function proveExts(array $static_extensions, array $shared_extensions = [], bool $skip_check_deps = false, bool $skip_extract = false): void { CustomExt::loadCustomExt(); // judge ext @@ -189,17 +189,20 @@ abstract class BuilderBase throw new WrongUsageException('Extension [' . $ext . '] does not support shared build!'); } } - $this->emitPatchPoint('before-php-extract'); - SourceManager::initSource(sources: ['php-src'], source_only: true); - $this->emitPatchPoint('after-php-extract'); - if ($this->getPHPVersionID() >= 80000) { - $this->emitPatchPoint('before-micro-extract'); - SourceManager::initSource(sources: ['micro'], source_only: true); - $this->emitPatchPoint('after-micro-extract'); + if (!$skip_extract) { + $this->emitPatchPoint('before-php-extract'); + SourceManager::initSource(sources: ['php-src'], source_only: true); + $this->emitPatchPoint('after-php-extract'); + if ($this->getPHPVersionID() >= 80000) { + $this->emitPatchPoint('before-micro-extract'); + SourceManager::initSource(sources: ['micro'], source_only: true); + $this->emitPatchPoint('after-micro-extract'); + } + $this->emitPatchPoint('before-exts-extract'); + SourceManager::initSource(exts: [...$static_extensions, ...$shared_extensions]); + $this->emitPatchPoint('after-exts-extract'); } - $this->emitPatchPoint('before-exts-extract'); - SourceManager::initSource(exts: [...$static_extensions, ...$shared_extensions]); - $this->emitPatchPoint('after-exts-extract'); + foreach ([...$static_extensions, ...$shared_extensions] as $extension) { $class = CustomExt::getExtClass($extension); /** @var Extension $ext */ diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index cc888d9a..e0b92a2e 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -50,7 +50,7 @@ class SPCConfigUtil if ($this->builder === null) { $this->builder = BuilderProvider::makeBuilderByInput(new ArgvInput()); $this->builder->proveLibs($libraries); - $this->builder->proveExts($extensions); + $this->builder->proveExts($extensions, skip_extract: true); } ob_get_clean(); $ldflags = $this->getLdflagsString();