From 85b9f5e05576cc8774322271ff95d37d61924a7b Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 6 Apr 2026 13:15:25 +0800 Subject: [PATCH] Refactor package resolution to filter only available build artifacts --- .../Runtime/Executor/UnixCMakeExecutor.php | 2 +- src/StaticPHP/Util/SPCConfigUtil.php | 28 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/StaticPHP/Runtime/Executor/UnixCMakeExecutor.php b/src/StaticPHP/Runtime/Executor/UnixCMakeExecutor.php index 2269c323..73209fff 100644 --- a/src/StaticPHP/Runtime/Executor/UnixCMakeExecutor.php +++ b/src/StaticPHP/Runtime/Executor/UnixCMakeExecutor.php @@ -233,7 +233,7 @@ class UnixCMakeExecutor extends Executor if ($this->package instanceof TargetPackage) { $resolvedNames = array_keys($this->installer->getResolvedPackages()); $resolvedNames[] = $this->package->getName(); - $fwFlags = SPCConfigUtil::getFrameworksString($resolvedNames); + $fwFlags = new SPCConfigUtil()->getFrameworksString($resolvedNames); if ($fwFlags !== '') { $exeLinkerFlags .= " {$fwFlags}"; } diff --git a/src/StaticPHP/Util/SPCConfigUtil.php b/src/StaticPHP/Util/SPCConfigUtil.php index ece95f39..63b0e90e 100644 --- a/src/StaticPHP/Util/SPCConfigUtil.php +++ b/src/StaticPHP/Util/SPCConfigUtil.php @@ -285,6 +285,20 @@ class SPCConfigUtil ]; } + public function getFrameworksString(array $extensions): string + { + $list = []; + foreach ($extensions as $extension) { + foreach (PackageConfig::get($extension, 'frameworks', []) as $fw) { + $ks = '-framework ' . $fw; + if (!in_array($ks, $list)) { + $list[] = $ks; + } + } + } + return implode(' ', $list); + } + private function hasCpp(array $packages): bool { foreach ($packages as $package) { @@ -492,18 +506,4 @@ class SPCConfigUtil } return $lib; } - - private function getFrameworksString(array $extensions): string - { - $list = []; - foreach ($extensions as $extension) { - foreach (PackageConfig::get($extension, 'frameworks', []) as $fw) { - $ks = '-framework ' . $fw; - if (!in_array($ks, $list)) { - $list[] = $ks; - } - } - } - return implode(' ', $list); - } }