Enhance exception handling by binding builder and extra info to ExceptionHandler

This commit is contained in:
crazywhalecc
2025-08-11 10:48:48 +08:00
parent 1e9434221b
commit 2fba61e9bd
5 changed files with 111 additions and 73 deletions

View File

@@ -229,6 +229,9 @@ abstract class BuilderBase
*/
abstract public function testPHP(int $build_target = BUILD_TARGET_NONE);
/**
* Build shared extensions.
*/
public function buildSharedExts(): void
{
$lines = file(BUILD_BIN_PATH . '/php-config');

View File

@@ -8,6 +8,7 @@ use SPC\builder\freebsd\BSDBuilder;
use SPC\builder\linux\LinuxBuilder;
use SPC\builder\macos\MacOSBuilder;
use SPC\builder\windows\WindowsBuilder;
use SPC\exception\ExceptionHandler;
use SPC\exception\WrongUsageException;
use Symfony\Component\Console\Input\InputInterface;
@@ -29,6 +30,10 @@ class BuilderProvider
'BSD' => new BSDBuilder($input->getOptions()),
default => throw new WrongUsageException('Current OS "' . PHP_OS_FAMILY . '" is not supported yet'),
};
// bind the builder to ExceptionHandler
ExceptionHandler::$bind_builder = self::$builder;
return self::$builder;
}