Remove all @throws PHPDoc, it's almost useless for SPC anymore

This commit is contained in:
crazywhalecc 2025-08-06 20:17:26 +08:00 committed by Jerry Ma
parent fa10142f13
commit 0c9a30256e
120 changed files with 169 additions and 1203 deletions

View File

@ -8,8 +8,6 @@ use SPC\builder\freebsd\BSDBuilder;
use SPC\builder\linux\LinuxBuilder; use SPC\builder\linux\LinuxBuilder;
use SPC\builder\macos\MacOSBuilder; use SPC\builder\macos\MacOSBuilder;
use SPC\builder\windows\WindowsBuilder; use SPC\builder\windows\WindowsBuilder;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException; use SPC\exception\WrongUsageException;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
@ -20,11 +18,6 @@ class BuilderProvider
{ {
private static ?BuilderBase $builder = null; private static ?BuilderBase $builder = null;
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public static function makeBuilderByInput(InputInterface $input): BuilderBase public static function makeBuilderByInput(InputInterface $input): BuilderBase
{ {
ini_set('memory_limit', '4G'); ini_set('memory_limit', '4G');
@ -39,9 +32,6 @@ class BuilderProvider
return self::$builder; return self::$builder;
} }
/**
* @throws WrongUsageException
*/
public static function getBuilder(): BuilderBase public static function getBuilder(): BuilderBase
{ {
if (self::$builder === null) { if (self::$builder === null) {

View File

@ -24,11 +24,6 @@ class Extension
protected string $source_dir; protected string $source_dir;
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public function __construct(protected string $name, protected BuilderBase $builder) public function __construct(protected string $name, protected BuilderBase $builder)
{ {
$ext_type = Config::getExt($this->name, 'type'); $ext_type = Config::getExt($this->name, 'type');
@ -63,9 +58,6 @@ class Extension
/** /**
* 获取开启该扩展的 PHP 编译添加的参数 * 获取开启该扩展的 PHP 编译添加的参数
*
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public function getConfigureArg(bool $shared = false): string public function getConfigureArg(bool $shared = false): string
{ {
@ -80,9 +72,6 @@ class Extension
/** /**
* 根据 ext arg-type 获取对应开启的参数,一般都是 --enable-xxx --with-xxx * 根据 ext arg-type 获取对应开启的参数,一般都是 --enable-xxx --with-xxx
*
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public function getEnableArg(bool $shared = false): string public function getEnableArg(bool $shared = false): string
{ {
@ -112,10 +101,6 @@ class Extension
/** /**
* 检查下依赖就行了,作用是导入依赖给 Extension 对象,今后可以对库依赖进行选择性处理 * 检查下依赖就行了,作用是导入依赖给 Extension 对象,今后可以对库依赖进行选择性处理
*
* @throws RuntimeException
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public function checkDependency(): static public function checkDependency(): static
{ {
@ -259,8 +244,6 @@ class Extension
* i.e.; pdo_pgsql would return: * i.e.; pdo_pgsql would return:
* *
* `-d "extension=pgsql" -d "extension=pdo_pgsql"` * `-d "extension=pgsql" -d "extension=pdo_pgsql"`
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public function getSharedExtensionLoadString(): string public function getSharedExtensionLoadString(): string
{ {
@ -300,9 +283,6 @@ class Extension
return $ret; return $ret;
} }
/**
* @throws RuntimeException
*/
public function runCliCheckUnix(): void public function runCliCheckUnix(): void
{ {
// Run compile check if build target is cli // Run compile check if build target is cli
@ -333,9 +313,6 @@ class Extension
} }
} }
/**
* @throws RuntimeException
*/
public function runCliCheckWindows(): void public function runCliCheckWindows(): void
{ {
// Run compile check if build target is cli // Run compile check if build target is cli
@ -368,9 +345,6 @@ class Extension
/** /**
* Build shared extension * Build shared extension
*
* @throws WrongUsageException
* @throws RuntimeException
*/ */
public function buildShared(): void public function buildShared(): void
{ {
@ -406,12 +380,6 @@ class Extension
/** /**
* Build shared extension for Unix * Build shared extension for Unix
*
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
* @throws \ReflectionException
* @throws \Throwable
*/ */
public function buildUnixShared(): void public function buildUnixShared(): void
{ {
@ -506,9 +474,6 @@ class Extension
return $this->build_static; return $this->build_static;
} }
/**
* @throws RuntimeException
*/
protected function addLibraryDependency(string $name, bool $optional = false): void protected function addLibraryDependency(string $name, bool $optional = false): void
{ {
$depLib = $this->builder->getLib($name); $depLib = $this->builder->getLib($name);
@ -522,9 +487,6 @@ class Extension
} }
} }
/**
* @throws RuntimeException
*/
protected function addExtensionDependency(string $name, bool $optional = false): void protected function addExtensionDependency(string $name, bool $optional = false): void
{ {
$depExt = $this->builder->getExt($name); $depExt = $this->builder->getExt($name);

View File

@ -27,9 +27,6 @@ abstract class LibraryBase
protected bool $patched = false; protected bool $patched = false;
/**
* @throws RuntimeException
*/
public function __construct(?string $source_dir = null) public function __construct(?string $source_dir = null)
{ {
if (static::NAME === 'unknown') { if (static::NAME === 'unknown') {
@ -41,9 +38,6 @@ abstract class LibraryBase
/** /**
* Try to install or build this library. * Try to install or build this library.
* @param bool $force If true, force install or build * @param bool $force If true, force install or build
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/ */
public function setup(bool $force = false): int public function setup(bool $force = false): int
{ {
@ -107,10 +101,6 @@ abstract class LibraryBase
/** /**
* Calculate dependencies for current library. * Calculate dependencies for current library.
*
* @throws RuntimeException
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public function calcDependency(): void public function calcDependency(): void
{ {
@ -131,9 +121,6 @@ abstract class LibraryBase
/** /**
* Get config static libs. * Get config static libs.
*
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public function getStaticLibs(): array public function getStaticLibs(): array
{ {
@ -142,9 +129,6 @@ abstract class LibraryBase
/** /**
* Get config headers. * Get config headers.
*
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public function getHeaders(): array public function getHeaders(): array
{ {
@ -153,19 +137,12 @@ abstract class LibraryBase
/** /**
* Get binary files. * Get binary files.
*
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public function getBinaryFiles(): array public function getBinaryFiles(): array
{ {
return Config::getLib(static::NAME, 'bin', []); return Config::getLib(static::NAME, 'bin', []);
} }
/**
* @throws WrongUsageException
* @throws FileSystemException
*/
public function tryInstall(array $lock, bool $force_install = false): int public function tryInstall(array $lock, bool $force_install = false): int
{ {
$install_file = $lock['filename']; $install_file = $lock['filename'];
@ -194,10 +171,6 @@ abstract class LibraryBase
* BUILD_STATUS_OK if build success * BUILD_STATUS_OK if build success
* BUILD_STATUS_ALREADY if already built * BUILD_STATUS_ALREADY if already built
* BUILD_STATUS_FAILED if build failed * BUILD_STATUS_FAILED if build failed
*
* @throws RuntimeException
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public function tryBuild(bool $force_build = false): int public function tryBuild(bool $force_build = false): int
{ {
@ -319,8 +292,6 @@ abstract class LibraryBase
/** /**
* Build this library. * Build this library.
*
* @throws RuntimeException
*/ */
abstract protected function build(); abstract protected function build();
@ -351,8 +322,6 @@ abstract class LibraryBase
/** /**
* Add lib dependency * Add lib dependency
*
* @throws RuntimeException
*/ */
protected function addLibraryDependency(string $name, bool $optional = false): void protected function addLibraryDependency(string $name, bool $optional = false): void
{ {

View File

@ -6,18 +6,12 @@ namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\builder\macos\MacOSBuilder; use SPC\builder\macos\MacOSBuilder;
use SPC\exception\FileSystemException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('bz2')] #[CustomExt('bz2')]
class bz2 extends Extension class bz2 extends Extension
{ {
/**
* @throws FileSystemException
* @throws WrongUsageException
*/
public function patchBeforeConfigure(): bool public function patchBeforeConfigure(): bool
{ {
$frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : ''; $frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : '';

View File

@ -16,9 +16,6 @@ use SPC\util\CustomExt;
#[CustomExt('curl')] #[CustomExt('curl')]
class curl extends Extension class curl extends Extension
{ {
/**
* @throws FileSystemException
*/
public function patchBeforeBuildconf(): bool public function patchBeforeBuildconf(): bool
{ {
logger()->info('patching before-configure for curl checks'); logger()->info('patching before-configure for curl checks');
@ -46,10 +43,6 @@ class curl extends Extension
return true; return true;
} }
/**
* @throws FileSystemException
* @throws WrongUsageException
*/
public function patchBeforeConfigure(): bool public function patchBeforeConfigure(): bool
{ {
$frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : ''; $frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : '';

View File

@ -5,16 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension; namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('dom')] #[CustomExt('dom')]
class dom extends Extension class dom extends Extension
{ {
/**
* @throws RuntimeException
*/
public function getUnixConfigureArg(bool $shared = false): string public function getUnixConfigureArg(bool $shared = false): string
{ {
$arg = '--enable-dom' . ($shared ? '=shared' : ''); $arg = '--enable-dom' . ($shared ? '=shared' : '');

View File

@ -5,16 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension; namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('ev')] #[CustomExt('ev')]
class ev extends Extension class ev extends Extension
{ {
/**
* @throws FileSystemException
*/
public function patchBeforeBuildconf(): bool public function patchBeforeBuildconf(): bool
{ {
/* /*

View File

@ -6,7 +6,6 @@ namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\builder\macos\MacOSBuilder; use SPC\builder\macos\MacOSBuilder;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
@ -27,18 +26,12 @@ class event extends Extension
return $arg; return $arg;
} }
/**
* @throws FileSystemException
*/
public function patchBeforeConfigure(): bool public function patchBeforeConfigure(): bool
{ {
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-levent_openssl/', $this->getLibFilesString()); FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-levent_openssl/', $this->getLibFilesString());
return true; return true;
} }
/**
* @throws FileSystemException
*/
public function patchBeforeMake(): bool public function patchBeforeMake(): bool
{ {
$patched = parent::patchBeforeMake(); $patched = parent::patchBeforeMake();

View File

@ -6,17 +6,12 @@ namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\builder\macos\MacOSBuilder; use SPC\builder\macos\MacOSBuilder;
use SPC\exception\FileSystemException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('gettext')] #[CustomExt('gettext')]
class gettext extends Extension class gettext extends Extension
{ {
/**
* @throws FileSystemException
*/
public function patchBeforeBuildconf(): bool public function patchBeforeBuildconf(): bool
{ {
if ($this->builder instanceof MacOSBuilder) { if ($this->builder instanceof MacOSBuilder) {
@ -25,10 +20,6 @@ class gettext extends Extension
return true; return true;
} }
/**
* @throws WrongUsageException
* @throws FileSystemException
*/
public function patchBeforeConfigure(): bool public function patchBeforeConfigure(): bool
{ {
if ($this->builder instanceof MacOSBuilder) { if ($this->builder instanceof MacOSBuilder) {

View File

@ -5,16 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension; namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('glfw')] #[CustomExt('glfw')]
class glfw extends Extension class glfw extends Extension
{ {
/**
* @throws RuntimeException
*/
public function patchBeforeBuildconf(): bool public function patchBeforeBuildconf(): bool
{ {
if (file_exists(SOURCE_PATH . '/php-src/ext/glfw')) { if (file_exists(SOURCE_PATH . '/php-src/ext/glfw')) {

View File

@ -24,9 +24,6 @@ class imap extends Extension
return false; return false;
} }
/**
* @throws WrongUsageException
*/
public function validate(): void public function validate(): void
{ {
if ($this->builder->getOption('enable-zts')) { if ($this->builder->getOption('enable-zts')) {

View File

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace SPC\builder\extension; namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
@ -17,9 +16,6 @@ class memcache extends Extension
return '--enable-memcache' . ($shared ? '=shared' : '') . ' --with-zlib-dir=' . BUILD_ROOT_PATH; return '--enable-memcache' . ($shared ? '=shared' : '') . ' --with-zlib-dir=' . BUILD_ROOT_PATH;
} }
/**
* @throws FileSystemException
*/
public function patchBeforeBuildconf(): bool public function patchBeforeBuildconf(): bool
{ {
FileSystem::replaceFileStr( FileSystem::replaceFileStr(

View File

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace SPC\builder\extension; namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException; use SPC\exception\WrongUsageException;
use SPC\store\SourcePatcher; use SPC\store\SourcePatcher;
use SPC\util\CustomExt; use SPC\util\CustomExt;
@ -13,10 +12,6 @@ use SPC\util\CustomExt;
#[CustomExt('opcache')] #[CustomExt('opcache')]
class opcache extends Extension class opcache extends Extension
{ {
/**
* @throws WrongUsageException
* @throws RuntimeException
*/
public function validate(): void public function validate(): void
{ {
if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') { if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {

View File

@ -5,16 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension; namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('pdo_sqlite')] #[CustomExt('pdo_sqlite')]
class pdo_sqlite extends Extension class pdo_sqlite extends Extension
{ {
/**
* @throws FileSystemException
*/
public function patchBeforeConfigure(): bool public function patchBeforeConfigure(): bool
{ {
FileSystem::replaceFileRegex( FileSystem::replaceFileRegex(

View File

@ -5,20 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension; namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('pgsql')] #[CustomExt('pgsql')]
class pgsql extends Extension class pgsql extends Extension
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public function patchBeforeConfigure(): bool public function patchBeforeConfigure(): bool
{ {
FileSystem::replaceFileRegex( FileSystem::replaceFileRegex(
@ -29,10 +21,6 @@ class pgsql extends Extension
return true; return true;
} }
/**
* @throws WrongUsageException
* @throws RuntimeException
*/
public function getUnixConfigureArg(bool $shared = false): string public function getUnixConfigureArg(bool $shared = false): string
{ {
if ($this->builder->getPHPVersionID() >= 80400) { if ($this->builder->getPHPVersionID() >= 80400) {
@ -46,10 +34,6 @@ class pgsql extends Extension
return '--with-pgsql=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH; return '--with-pgsql=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH;
} }
/**
* @throws WrongUsageException
* @throws RuntimeException
*/
public function getWindowsConfigureArg(bool $shared = false): string public function getWindowsConfigureArg(bool $shared = false): string
{ {
if ($this->builder->getPHPVersionID() >= 80400) { if ($this->builder->getPHPVersionID() >= 80400) {

View File

@ -6,16 +6,12 @@ namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\builder\macos\MacOSBuilder; use SPC\builder\macos\MacOSBuilder;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('rar')] #[CustomExt('rar')]
class rar extends Extension class rar extends Extension
{ {
/**
* @throws FileSystemException
*/
public function patchBeforeBuildconf(): bool public function patchBeforeBuildconf(): bool
{ {
// workaround for newer Xcode clang (>= 15.0) // workaround for newer Xcode clang (>= 15.0)

View File

@ -5,16 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension; namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('readline')] #[CustomExt('readline')]
class readline extends Extension class readline extends Extension
{ {
/**
* @throws FileSystemException
*/
public function patchBeforeConfigure(): bool public function patchBeforeConfigure(): bool
{ {
FileSystem::replaceFileRegex( FileSystem::replaceFileRegex(

View File

@ -6,16 +6,12 @@ namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\builder\macos\MacOSBuilder; use SPC\builder\macos\MacOSBuilder;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('snappy')] #[CustomExt('snappy')]
class snappy extends Extension class snappy extends Extension
{ {
/**
* @throws FileSystemException
*/
public function patchBeforeConfigure(): bool public function patchBeforeConfigure(): bool
{ {
FileSystem::replaceFileRegex( FileSystem::replaceFileRegex(

View File

@ -5,16 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension; namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('ssh2')] #[CustomExt('ssh2')]
class ssh2 extends Extension class ssh2 extends Extension
{ {
/**
* @throws FileSystemException
*/
public function patchBeforeConfigure(): bool public function patchBeforeConfigure(): bool
{ {
FileSystem::replaceFileRegex( FileSystem::replaceFileRegex(

View File

@ -26,9 +26,6 @@ class swow extends Extension
return $arg; return $arg;
} }
/**
* @throws RuntimeException
*/
public function patchBeforeBuildconf(): bool public function patchBeforeBuildconf(): bool
{ {
if ($this->builder->getPHPVersionID() >= 80000 && !is_link(SOURCE_PATH . '/php-src/ext/swow')) { if ($this->builder->getPHPVersionID() >= 80000 && !is_link(SOURCE_PATH . '/php-src/ext/swow')) {

View File

@ -16,9 +16,6 @@ use SPC\util\CustomExt;
#[CustomExt('simplexml')] #[CustomExt('simplexml')]
class xml extends Extension class xml extends Extension
{ {
/**
* @throws RuntimeException
*/
public function getUnixConfigureArg(bool $shared = false): string public function getUnixConfigureArg(bool $shared = false): string
{ {
$arg = match ($this->name) { $arg = match ($this->name) {

View File

@ -5,8 +5,6 @@ declare(strict_types=1);
namespace SPC\builder\freebsd; namespace SPC\builder\freebsd;
use SPC\builder\unix\UnixBuilderBase; use SPC\builder\unix\UnixBuilderBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException; use SPC\exception\WrongUsageException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\store\SourcePatcher; use SPC\store\SourcePatcher;
@ -16,11 +14,6 @@ class BSDBuilder extends UnixBuilderBase
/** @var bool Micro patch phar flag */ /** @var bool Micro patch phar flag */
private bool $phar_patched = false; private bool $phar_patched = false;
/**
* @throws RuntimeException
* @throws WrongUsageException
* @throws FileSystemException
*/
public function __construct(array $options = []) public function __construct(array $options = [])
{ {
$this->options = $options; $this->options = $options;
@ -57,9 +50,6 @@ class BSDBuilder extends UnixBuilderBase
* Just start to build statically linked php binary * Just start to build statically linked php binary
* *
* @param int $build_target build target * @param int $build_target build target
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/ */
public function buildPHP(int $build_target = BUILD_TARGET_NONE): void public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
{ {
@ -148,9 +138,6 @@ class BSDBuilder extends UnixBuilderBase
/** /**
* Build cli sapi * Build cli sapi
*
* @throws RuntimeException
* @throws FileSystemException
*/ */
protected function buildCli(): void protected function buildCli(): void
{ {
@ -170,10 +157,6 @@ class BSDBuilder extends UnixBuilderBase
/** /**
* Build phpmicro sapi * Build phpmicro sapi
*
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/ */
protected function buildMicro(): void protected function buildMicro(): void
{ {
@ -209,9 +192,6 @@ class BSDBuilder extends UnixBuilderBase
/** /**
* Build fpm sapi * Build fpm sapi
*
* @throws RuntimeException
* @throws FileSystemException
*/ */
protected function buildFpm(): void protected function buildFpm(): void
{ {
@ -230,8 +210,6 @@ class BSDBuilder extends UnixBuilderBase
/** /**
* Build embed sapi * Build embed sapi
*
* @throws RuntimeException
*/ */
protected function buildEmbed(): void protected function buildEmbed(): void
{ {

View File

@ -15,8 +15,6 @@ class SystemUtil
/** /**
* Get Logic CPU Count for macOS * Get Logic CPU Count for macOS
*
* @throws RuntimeException
*/ */
public static function getCpuCount(): int public static function getCpuCount(): int
{ {
@ -33,7 +31,6 @@ class SystemUtil
* *
* @param string $arch Arch Name * @param string $arch Arch Name
* @return string return Arch CFlags string * @return string return Arch CFlags string
* @throws WrongUsageException
*/ */
public static function getArchCFlags(string $arch): string public static function getArchCFlags(string $arch): string
{ {

View File

@ -22,19 +22,11 @@ declare(strict_types=1);
namespace SPC\builder\freebsd\library; namespace SPC\builder\freebsd\library;
use SPC\builder\macos\library\MacOSLibraryBase; use SPC\builder\macos\library\MacOSLibraryBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
class openssl extends BSDLibraryBase class openssl extends BSDLibraryBase
{ {
public const NAME = 'openssl'; public const NAME = 'openssl';
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void protected function build(): void
{ {
[$lib,,$destdir] = SEPARATED_PATH; [$lib,,$destdir] = SEPARATED_PATH;

View File

@ -5,8 +5,7 @@ declare(strict_types=1);
namespace SPC\builder\linux; namespace SPC\builder\linux;
use SPC\builder\unix\UnixBuilderBase; use SPC\builder\unix\UnixBuilderBase;
use SPC\exception\FileSystemException; use SPC\exception\PatchException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException; use SPC\exception\WrongUsageException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\store\SourcePatcher; use SPC\store\SourcePatcher;
@ -19,10 +18,6 @@ class LinuxBuilder extends UnixBuilderBase
/** @var bool Micro patch phar flag */ /** @var bool Micro patch phar flag */
private bool $phar_patched = false; private bool $phar_patched = false;
/**
* @throws FileSystemException
* @throws WrongUsageException
*/
public function __construct(array $options = []) public function __construct(array $options = [])
{ {
$this->options = $options; $this->options = $options;
@ -46,9 +41,6 @@ class LinuxBuilder extends UnixBuilderBase
* Build PHP from source. * Build PHP from source.
* *
* @param int $build_target Build target, use `BUILD_TARGET_*` constants * @param int $build_target Build target, use `BUILD_TARGET_*` constants
* @throws RuntimeException
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public function buildPHP(int $build_target = BUILD_TARGET_NONE): void public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
{ {
@ -168,9 +160,6 @@ class LinuxBuilder extends UnixBuilderBase
/** /**
* Build cli sapi * Build cli sapi
*
* @throws RuntimeException
* @throws FileSystemException
*/ */
protected function buildCli(): void protected function buildCli(): void
{ {
@ -193,10 +182,6 @@ class LinuxBuilder extends UnixBuilderBase
/** /**
* Build phpmicro sapi * Build phpmicro sapi
*
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/ */
protected function buildMicro(): void protected function buildMicro(): void
{ {
@ -231,9 +216,6 @@ class LinuxBuilder extends UnixBuilderBase
/** /**
* Build fpm sapi * Build fpm sapi
*
* @throws FileSystemException
* @throws RuntimeException
*/ */
protected function buildFpm(): void protected function buildFpm(): void
{ {
@ -255,8 +237,6 @@ class LinuxBuilder extends UnixBuilderBase
/** /**
* Build embed sapi * Build embed sapi
*
* @throws RuntimeException
*/ */
protected function buildEmbed(): void protected function buildEmbed(): void
{ {
@ -346,12 +326,6 @@ class LinuxBuilder extends UnixBuilderBase
/** /**
* Return extra variables for php make command. * Return extra variables for php make command.
*
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
* @throws \ReflectionException
* @throws \Throwable
*/ */
private function getMakeExtraVars(): array private function getMakeExtraVars(): array
{ {
@ -370,8 +344,6 @@ class LinuxBuilder extends UnixBuilderBase
* Strip micro.sfx for Linux. * Strip micro.sfx for Linux.
* The micro.sfx does not support UPX directly, but we can remove UPX-info segment to adapt. * The micro.sfx does not support UPX directly, but we can remove UPX-info segment to adapt.
* This will also make micro.sfx with upx-packed more like a malware fore antivirus :( * This will also make micro.sfx with upx-packed more like a malware fore antivirus :(
*
* @throws RuntimeException
*/ */
private function processMicroUPX(): void private function processMicroUPX(): void
{ {

View File

@ -4,8 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\linux\library; namespace SPC\builder\linux\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\SPCTarget; use SPC\util\SPCTarget;
@ -13,9 +11,6 @@ class imap extends LinuxLibraryBase
{ {
public const NAME = 'imap'; public const NAME = 'imap';
/**
* @throws FileSystemException
*/
public function patchBeforeBuild(): bool public function patchBeforeBuild(): bool
{ {
$cc = getenv('CC') ?: 'gcc'; $cc = getenv('CC') ?: 'gcc';

View File

@ -4,18 +4,12 @@ declare(strict_types=1);
namespace SPC\builder\linux\library; namespace SPC\builder\linux\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
class libffi extends LinuxLibraryBase class libffi extends LinuxLibraryBase
{ {
public const NAME = 'libffi'; public const NAME = 'libffi';
/**
* @throws RuntimeException
* @throws FileSystemException
*/
public function build(): void public function build(): void
{ {
UnixAutoconfExecutor::create($this) UnixAutoconfExecutor::create($this)

View File

@ -21,20 +21,12 @@ declare(strict_types=1);
namespace SPC\builder\linux\library; namespace SPC\builder\linux\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
class libpng extends LinuxLibraryBase class libpng extends LinuxLibraryBase
{ {
public const NAME = 'libpng'; public const NAME = 'libpng';
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public function build(): void public function build(): void
{ {
UnixAutoconfExecutor::create($this) UnixAutoconfExecutor::create($this)

View File

@ -21,9 +21,6 @@ declare(strict_types=1);
namespace SPC\builder\linux\library; namespace SPC\builder\linux\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
class openssl extends LinuxLibraryBase class openssl extends LinuxLibraryBase
@ -32,11 +29,6 @@ class openssl extends LinuxLibraryBase
public const NAME = 'openssl'; public const NAME = 'openssl';
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public function build(): void public function build(): void
{ {
$extra = ''; $extra = '';

View File

@ -6,8 +6,6 @@ namespace SPC\builder\macos;
use SPC\builder\macos\library\MacOSLibraryBase; use SPC\builder\macos\library\MacOSLibraryBase;
use SPC\builder\unix\UnixBuilderBase; use SPC\builder\unix\UnixBuilderBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException; use SPC\exception\WrongUsageException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\store\SourcePatcher; use SPC\store\SourcePatcher;
@ -19,11 +17,6 @@ class MacOSBuilder extends UnixBuilderBase
/** @var bool Micro patch phar flag */ /** @var bool Micro patch phar flag */
private bool $phar_patched = false; private bool $phar_patched = false;
/**
* @throws RuntimeException
* @throws WrongUsageException
* @throws FileSystemException
*/
public function __construct(array $options = []) public function __construct(array $options = [])
{ {
$this->options = $options; $this->options = $options;
@ -49,8 +42,6 @@ class MacOSBuilder extends UnixBuilderBase
* Get dynamically linked macOS frameworks * Get dynamically linked macOS frameworks
* *
* @param bool $asString If true, return as string * @param bool $asString If true, return as string
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public function getFrameworks(bool $asString = false): array|string public function getFrameworks(bool $asString = false): array|string
{ {
@ -84,9 +75,6 @@ class MacOSBuilder extends UnixBuilderBase
* Just start to build statically linked php binary * Just start to build statically linked php binary
* *
* @param int $build_target build target * @param int $build_target build target
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/ */
public function buildPHP(int $build_target = BUILD_TARGET_NONE): void public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
{ {
@ -190,9 +178,6 @@ class MacOSBuilder extends UnixBuilderBase
/** /**
* Build cli sapi * Build cli sapi
*
* @throws RuntimeException
* @throws FileSystemException
*/ */
protected function buildCli(): void protected function buildCli(): void
{ {
@ -209,10 +194,6 @@ class MacOSBuilder extends UnixBuilderBase
/** /**
* Build phpmicro sapi * Build phpmicro sapi
*
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/ */
protected function buildMicro(): void protected function buildMicro(): void
{ {
@ -248,9 +229,6 @@ class MacOSBuilder extends UnixBuilderBase
/** /**
* Build fpm sapi * Build fpm sapi
*
* @throws RuntimeException
* @throws FileSystemException
*/ */
protected function buildFpm(): void protected function buildFpm(): void
{ {
@ -266,8 +244,6 @@ class MacOSBuilder extends UnixBuilderBase
/** /**
* Build embed sapi * Build embed sapi
*
* @throws RuntimeException
*/ */
protected function buildEmbed(): void protected function buildEmbed(): void
{ {

View File

@ -15,8 +15,6 @@ class SystemUtil
/** /**
* Get Logic CPU Count for macOS * Get Logic CPU Count for macOS
*
* @throws RuntimeException
*/ */
public static function getCpuCount(): int public static function getCpuCount(): int
{ {
@ -33,7 +31,6 @@ class SystemUtil
* *
* @param string $arch Arch Name * @param string $arch Arch Name
* @return string return Arch CFlags string * @return string return Arch CFlags string
* @throws WrongUsageException
*/ */
public static function getArchCFlags(string $arch): string public static function getArchCFlags(string $arch): string
{ {

View File

@ -8,8 +8,6 @@ use SPC\builder\BuilderBase;
use SPC\builder\LibraryBase; use SPC\builder\LibraryBase;
use SPC\builder\macos\MacOSBuilder; use SPC\builder\macos\MacOSBuilder;
use SPC\builder\traits\UnixLibraryTrait; use SPC\builder\traits\UnixLibraryTrait;
use SPC\exception\FileSystemException;
use SPC\exception\WrongUsageException;
use SPC\store\Config; use SPC\store\Config;
abstract class MacOSLibraryBase extends LibraryBase abstract class MacOSLibraryBase extends LibraryBase
@ -28,10 +26,6 @@ abstract class MacOSLibraryBase extends LibraryBase
return $this->builder; return $this->builder;
} }
/**
* @throws WrongUsageException
* @throws FileSystemException
*/
public function getFrameworks(): array public function getFrameworks(): array
{ {
return Config::getLib(static::NAME, 'frameworks', []); return Config::getLib(static::NAME, 'frameworks', []);

View File

@ -21,7 +21,6 @@ declare(strict_types=1);
namespace SPC\builder\macos\library; namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
class curl extends MacOSLibraryBase class curl extends MacOSLibraryBase
@ -30,9 +29,6 @@ class curl extends MacOSLibraryBase
public const NAME = 'curl'; public const NAME = 'curl';
/**
* @throws FileSystemException
*/
public function patchBeforeBuild(): bool public function patchBeforeBuild(): bool
{ {
FileSystem::replaceFileRegex( FileSystem::replaceFileRegex(

View File

@ -4,18 +4,12 @@ declare(strict_types=1);
namespace SPC\builder\macos\library; namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
class glfw extends MacOSLibraryBase class glfw extends MacOSLibraryBase
{ {
public const NAME = 'glfw'; public const NAME = 'glfw';
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)

View File

@ -4,8 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\macos\library; namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\store\SourcePatcher; use SPC\store\SourcePatcher;
@ -13,10 +11,6 @@ class imap extends MacOSLibraryBase
{ {
public const NAME = 'imap'; public const NAME = 'imap';
/**
* @throws FileSystemException
* @throws RuntimeException
*/
public function patchBeforeBuild(): bool public function patchBeforeBuild(): bool
{ {
$cc = getenv('CC') ?: 'clang'; $cc = getenv('CC') ?: 'clang';
@ -37,9 +31,6 @@ class imap extends MacOSLibraryBase
return true; return true;
} }
/**
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
if ($this->builder->getLib('openssl')) { if ($this->builder->getLib('openssl')) {

View File

@ -4,18 +4,12 @@ declare(strict_types=1);
namespace SPC\builder\macos\library; namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
class libffi extends MacOSLibraryBase class libffi extends MacOSLibraryBase
{ {
public const NAME = 'libffi'; public const NAME = 'libffi';
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
$arch = getenv('SPC_ARCH'); $arch = getenv('SPC_ARCH');

View File

@ -21,20 +21,12 @@ declare(strict_types=1);
namespace SPC\builder\macos\library; namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
class libpng extends MacOSLibraryBase class libpng extends MacOSLibraryBase
{ {
public const NAME = 'libpng'; public const NAME = 'libpng';
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void protected function build(): void
{ {
$arch = arch2gnu(php_uname('m')); $arch = arch2gnu(php_uname('m'));

View File

@ -21,9 +21,6 @@ declare(strict_types=1);
namespace SPC\builder\macos\library; namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
class openssl extends MacOSLibraryBase class openssl extends MacOSLibraryBase
@ -32,11 +29,6 @@ class openssl extends MacOSLibraryBase
public const NAME = 'openssl'; public const NAME = 'openssl';
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void protected function build(): void
{ {
// lib:zlib // lib:zlib

View File

@ -13,11 +13,6 @@ use SPC\util\SPCConfigUtil;
trait UnixLibraryTrait trait UnixLibraryTrait
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
* @throws WrongUsageException
*/
public function getStaticLibFiles(bool $include_self = true): string public function getStaticLibFiles(bool $include_self = true): string
{ {
$libs = $include_self ? [$this] : []; $libs = $include_self ? [$this] : [];
@ -28,11 +23,11 @@ trait UnixLibraryTrait
} }
/** /**
* Patch pkgconfig file prefix * Patch pkgconfig file prefix, exec_prefix, libdir, includedir for correct build.
* *
* @param array $files file list * @param array $files File list to patch, if empty, will use pkg-configs from config (e.g. ['zlib.pc', 'openssl.pc'])
* @throws FileSystemException * @param int $patch_option Patch options
* @throws RuntimeException * @param null|array $custom_replace Custom replace rules, if provided, will be used to replace in the format [regex, replacement]
*/ */
public function patchPkgconfPrefix(array $files = [], int $patch_option = PKGCONF_PATCH_ALL, ?array $custom_replace = null): void public function patchPkgconfPrefix(array $files = [], int $patch_option = PKGCONF_PATCH_ALL, ?array $custom_replace = null): void
{ {

View File

@ -70,9 +70,7 @@ abstract class UnixBuilderBase extends BuilderBase
} }
/** /**
* Sanity check after build complete * Sanity check after build complete.
*
* @throws RuntimeException
*/ */
protected function sanityCheck(int $build_target): void protected function sanityCheck(int $build_target): void
{ {
@ -170,11 +168,9 @@ abstract class UnixBuilderBase extends BuilderBase
} }
/** /**
* 将编译好的二进制文件发布到 buildroot * Deploy the binary file to the build bin path.
* *
* @param int $type 发布类型 * @param int $type Type integer, one of BUILD_TARGET_CLI, BUILD_TARGET_MICRO, BUILD_TARGET_FPM
* @throws RuntimeException
* @throws FileSystemException
*/ */
protected function deployBinary(int $type): bool protected function deployBinary(int $type): bool
{ {
@ -192,8 +188,6 @@ abstract class UnixBuilderBase extends BuilderBase
/** /**
* Run php clean * Run php clean
*
* @throws RuntimeException
*/ */
protected function cleanMake(): void protected function cleanMake(): void
{ {
@ -203,7 +197,6 @@ abstract class UnixBuilderBase extends BuilderBase
/** /**
* Patch phpize and php-config if needed * Patch phpize and php-config if needed
* @throws FileSystemException
*/ */
protected function patchPhpScripts(): void protected function patchPhpScripts(): void
{ {
@ -231,10 +224,6 @@ abstract class UnixBuilderBase extends BuilderBase
} }
} }
/**
* @throws WrongUsageException
* @throws RuntimeException
*/
protected function buildFrankenphp(): void protected function buildFrankenphp(): void
{ {
$nobrotli = $this->getLib('brotli') === null ? ',nobrotli' : ''; $nobrotli = $this->getLib('brotli') === null ? ',nobrotli' : '';

View File

@ -4,14 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait attr trait attr
{ {
/**
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this) UnixAutoconfExecutor::create($this)

View File

@ -4,17 +4,11 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait brotli trait brotli
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait curl trait curl
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
shell()->cd($this->source_dir)->exec('sed -i.save s@\${CMAKE_C_IMPLICIT_LINK_LIBRARIES}@@ ./CMakeLists.txt'); shell()->cd($this->source_dir)->exec('sed -i.save s@\${CMAKE_C_IMPLICIT_LINK_LIBRARIES}@@ ./CMakeLists.txt');

View File

@ -4,19 +4,11 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait freetype trait freetype
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void protected function build(): void
{ {
$cmake = UnixCMakeExecutor::create($this) $cmake = UnixCMakeExecutor::create($this)

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait gmp trait gmp
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this)->configure()->make(); UnixAutoconfExecutor::create($this)->configure()->make();

View File

@ -4,20 +4,12 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
use SPC\util\SPCTarget; use SPC\util\SPCTarget;
trait imagemagick trait imagemagick
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
* @throws WrongUsageException
*/
protected function build(): void protected function build(): void
{ {
$ac = UnixAutoconfExecutor::create($this) $ac = UnixAutoconfExecutor::create($this)

View File

@ -4,24 +4,16 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
trait jbig trait jbig
{ {
/**
* @throws FileSystemException
*/
public function patchBeforeBuild(): bool public function patchBeforeBuild(): bool
{ {
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'CFLAGS = -O2 -W -Wno-unused-result', 'CFLAGS = -O2 -W -Wno-unused-result -fPIC'); FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'CFLAGS = -O2 -W -Wno-unused-result', 'CFLAGS = -O2 -W -Wno-unused-result -fPIC');
return true; return true;
} }
/**
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
shell()->cd($this->source_dir)->initializeEnv($this) shell()->cd($this->source_dir)->initializeEnv($this)

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait lerc trait lerc
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)

View File

@ -4,16 +4,11 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait libacl trait libacl
{ {
/**
* @throws FileSystemException
*/
public function patchBeforeMake(): bool public function patchBeforeMake(): bool
{ {
$file_path = SOURCE_PATH . '/php-src/Makefile'; $file_path = SOURCE_PATH . '/php-src/Makefile';
@ -25,9 +20,6 @@ trait libacl
return true; return true;
} }
/**
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this) UnixAutoconfExecutor::create($this)

View File

@ -4,18 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait libavif trait libavif
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
@ -20,9 +19,6 @@ trait libcares
return false; return false;
} }
/**
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this)->configure('--disable-tests')->make(); UnixAutoconfExecutor::create($this)->configure('--disable-tests')->make();

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait libde265 trait libde265
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)

View File

@ -4,8 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
@ -34,10 +32,6 @@ trait libevent
} }
} }
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
$cmake = UnixCMakeExecutor::create($this) $cmake = UnixCMakeExecutor::create($this)

View File

@ -4,8 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
@ -24,10 +22,6 @@ trait libheif
return false; return false;
} }
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)

View File

@ -4,18 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait libjpeg trait libjpeg
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait librabbitmq trait librabbitmq
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this)->addConfigureArgs('-DBUILD_STATIC_LIBS=ON')->build(); UnixCMakeExecutor::create($this)->addConfigureArgs('-DBUILD_STATIC_LIBS=ON')->build();

View File

@ -4,8 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
@ -26,10 +24,6 @@ trait librdkafka
return true; return true;
} }
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this) UnixAutoconfExecutor::create($this)

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait libssh2 trait libssh2
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)

View File

@ -4,18 +4,12 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
use SPC\util\SPCTarget; use SPC\util\SPCTarget;
trait libtiff trait libtiff
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
$libcpp = SPCTarget::getTargetOS() === 'Linux' ? '-lstdc++' : '-lc++'; $libcpp = SPCTarget::getTargetOS() === 'Linux' ? '-lstdc++' : '-lc++';

View File

@ -4,15 +4,11 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait libuuid trait libuuid
{ {
/**
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this)->toStep(2)->build(); UnixCMakeExecutor::create($this)->toStep(2)->build();

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait libuv trait libuv
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)

View File

@ -4,18 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait libwebp trait libwebp
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)

View File

@ -5,15 +5,11 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\builder\linux\library\LinuxLibraryBase; use SPC\builder\linux\library\LinuxLibraryBase;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait libxml2 trait libxml2
{ {
/**
* @throws FileSystemException
*/
public function build(): void public function build(): void
{ {
$cmake = UnixCMakeExecutor::create($this) $cmake = UnixCMakeExecutor::create($this)

View File

@ -6,18 +6,10 @@ namespace SPC\builder\unix\library;
use SPC\builder\linux\library\LinuxLibraryBase; use SPC\builder\linux\library\LinuxLibraryBase;
use SPC\builder\macos\library\MacOSLibraryBase; use SPC\builder\macos\library\MacOSLibraryBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait libxslt trait libxslt
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void protected function build(): void
{ {
$static_libs = $this instanceof LinuxLibraryBase ? $this->getStaticLibFiles(include_self: false) : ''; $static_libs = $this instanceof LinuxLibraryBase ? $this->getStaticLibFiles(include_self: false) : '';

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait libzip trait libzip
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)

View File

@ -4,18 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait nghttp2 trait nghttp2
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this) UnixAutoconfExecutor::create($this)

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait nghttp3 trait nghttp3
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this)->configure('--enable-lib-only')->make(); UnixAutoconfExecutor::create($this)->configure('--enable-lib-only')->make();

View File

@ -6,18 +6,10 @@ namespace SPC\builder\unix\library;
use SPC\builder\linux\library\LinuxLibraryBase; use SPC\builder\linux\library\LinuxLibraryBase;
use SPC\builder\macos\library\MacOSLibraryBase; use SPC\builder\macos\library\MacOSLibraryBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait ngtcp2 trait ngtcp2
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this) UnixAutoconfExecutor::create($this)

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait onig trait onig
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this)->configure()->make(); UnixAutoconfExecutor::create($this)->configure()->make();

View File

@ -12,10 +12,6 @@ use SPC\util\SPCTarget;
trait postgresql trait postgresql
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
$builddir = BUILD_ROOT_PATH; $builddir = BUILD_ROOT_PATH;

View File

@ -5,17 +5,11 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\builder\macos\library\MacOSLibraryBase; use SPC\builder\macos\library\MacOSLibraryBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait qdbm trait qdbm
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
$ac = UnixAutoconfExecutor::create($this)->configure(); $ac = UnixAutoconfExecutor::create($this)->configure();

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait readline trait readline
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this) UnixAutoconfExecutor::create($this)

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait snappy trait snappy
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait tidy trait tidy
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
$cmake = UnixCMakeExecutor::create($this) $cmake = UnixCMakeExecutor::create($this)

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait unixodbc trait unixodbc
{ {
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this) UnixAutoconfExecutor::create($this)

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
trait watcher trait watcher
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
$cflags = $this->getLibExtraCXXFlags(); $cflags = $this->getLibExtraCXXFlags();

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait xz trait xz
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
*/
public function build(): void public function build(): void
{ {
UnixAutoconfExecutor::create($this) UnixAutoconfExecutor::create($this)

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait zlib trait zlib
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this)->exec("./configure --static --prefix={$this->getBuildRootPath()}")->make(); UnixAutoconfExecutor::create($this)->exec("./configure --static --prefix={$this->getBuildRootPath()}")->make();

View File

@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait zstd trait zstd
{ {
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void protected function build(): void
{ {
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)

View File

@ -77,7 +77,6 @@ class SystemUtil
* *
* @param null|string $cflags CFLAGS for cmake, default use '/MT /Os /Ob1 /DNDEBUG /D_ACRTIMP= /D_CRTIMP=' * @param null|string $cflags CFLAGS for cmake, default use '/MT /Os /Ob1 /DNDEBUG /D_ACRTIMP= /D_CRTIMP='
* @param null|string $ldflags LDFLAGS for cmake, default use '/nodefaultlib:msvcrt /nodefaultlib:msvcrtd /defaultlib:libcmt' * @param null|string $ldflags LDFLAGS for cmake, default use '/nodefaultlib:msvcrt /nodefaultlib:msvcrtd /defaultlib:libcmt'
* @throws FileSystemException
*/ */
public static function makeCmakeToolchainFile(?string $cflags = null, ?string $ldflags = null): string public static function makeCmakeToolchainFile(?string $cflags = null, ?string $ldflags = null): string
{ {

View File

@ -26,9 +26,6 @@ class WindowsBuilder extends BuilderBase
/** @var bool Micro patch phar flag */ /** @var bool Micro patch phar flag */
private bool $phar_patched = false; private bool $phar_patched = false;
/**
* @throws FileSystemException
*/
public function __construct(array $options = []) public function __construct(array $options = [])
{ {
$this->options = $options; $this->options = $options;
@ -54,11 +51,6 @@ class WindowsBuilder extends BuilderBase
f_mkdir(BUILD_LIB_PATH, recursive: true); f_mkdir(BUILD_LIB_PATH, recursive: true);
} }
/**
* @throws RuntimeException
* @throws WrongUsageException
* @throws FileSystemException
*/
public function buildPHP(int $build_target = BUILD_TARGET_NONE): void public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
{ {
$enableCli = ($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI; $enableCli = ($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI;
@ -153,10 +145,6 @@ class WindowsBuilder extends BuilderBase
$this->sanityCheck($build_target); $this->sanityCheck($build_target);
} }
/**
* @throws FileSystemException
* @throws RuntimeException
*/
public function buildCli(): void public function buildCli(): void
{ {
SourcePatcher::patchWindowsCLITarget(); SourcePatcher::patchWindowsCLITarget();
@ -182,11 +170,6 @@ class WindowsBuilder extends BuilderBase
*/ */
} }
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public function buildMicro(): void public function buildMicro(): void
{ {
// workaround for fiber (originally from https://github.com/dixyes/lwmbs/blob/master/windows/MicroBuild.php) // workaround for fiber (originally from https://github.com/dixyes/lwmbs/blob/master/windows/MicroBuild.php)
@ -262,10 +245,6 @@ class WindowsBuilder extends BuilderBase
$this->lib_list = $sorted_libraries; $this->lib_list = $sorted_libraries;
} }
/**
* @throws FileSystemException
* @throws RuntimeException
*/
public function cleanMake(): void public function cleanMake(): void
{ {
FileSystem::writeFile(SOURCE_PATH . '\php-src\nmake_clean_wrapper.bat', 'nmake /nologo %*'); FileSystem::writeFile(SOURCE_PATH . '\php-src\nmake_clean_wrapper.bat', 'nmake /nologo %*');
@ -274,8 +253,6 @@ class WindowsBuilder extends BuilderBase
/** /**
* Run extension and PHP cli and micro check * Run extension and PHP cli and micro check
*
* @throws RuntimeException
*/ */
public function sanityCheck(mixed $build_target): void public function sanityCheck(mixed $build_target): void
{ {
@ -321,11 +298,9 @@ class WindowsBuilder extends BuilderBase
} }
/** /**
* 将编译好的二进制文件发布到 buildroot * Deploy the binary file to buildroot/bin/
* *
* @param int $type 发布类型 * @param int $type Deploy type
* @throws RuntimeException
* @throws FileSystemException
*/ */
public function deployBinary(int $type): bool public function deployBinary(int $type): bool
{ {
@ -350,34 +325,6 @@ class WindowsBuilder extends BuilderBase
return true; return true;
} }
/**
* @throws WrongUsageException
* @throws FileSystemException
*/
public function getAllStaticLibFiles(): array
{
$libs = [];
// reorder libs
foreach ($this->libs as $lib) {
foreach ($lib->getDependencies() as $dep) {
$libs[] = $dep;
}
$libs[] = $lib;
}
$libFiles = [];
$libNames = [];
// merge libs
foreach ($libs as $lib) {
if (!in_array($lib::NAME, $libNames, true)) {
$libNames[] = $lib::NAME;
array_unshift($libFiles, ...$lib->getStaticLibs());
}
}
return $libFiles;
}
/** /**
* Generate command wrapper prefix for php-sdk internal commands. * Generate command wrapper prefix for php-sdk internal commands.
* *

View File

@ -5,8 +5,6 @@ declare(strict_types=1);
namespace SPC\command; namespace SPC\command;
use SPC\builder\BuilderProvider; use SPC\builder\BuilderProvider;
use SPC\exception\ExceptionHandler;
use SPC\exception\RuntimeException;
use SPC\store\Config; use SPC\store\Config;
use SPC\util\DependencyUtil; use SPC\util\DependencyUtil;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
@ -33,9 +31,6 @@ class BuildLibsCommand extends BuildCommand
parent::initialize($input, $output); parent::initialize($input, $output);
} }
/**
* @throws RuntimeException
*/
public function handle(): int public function handle(): int
{ {
// 从参数中获取要编译的 libraries并转换为数组 // 从参数中获取要编译的 libraries并转换为数组

View File

@ -34,9 +34,6 @@ class DeleteDownloadCommand extends BaseCommand
parent::initialize($input, $output); parent::initialize($input, $output);
} }
/**
* @throws FileSystemException
*/
public function handle(): int public function handle(): int
{ {
try { try {

View File

@ -47,10 +47,6 @@ class DownloadCommand extends BaseCommand
$this->addOption('no-alt', null, null, 'Do not download alternative sources'); $this->addOption('no-alt', null, null, 'Do not download alternative sources');
} }
/**
* @throws FileSystemException
* @throws WrongUsageException
*/
public function initialize(InputInterface $input, OutputInterface $output): void public function initialize(InputInterface $input, OutputInterface $output): void
{ {
// mode: --all // mode: --all
@ -89,10 +85,6 @@ class DownloadCommand extends BaseCommand
parent::initialize($input, $output); parent::initialize($input, $output);
} }
/**
* @throws FileSystemException
* @throws RuntimeException
*/
public function handle(): int public function handle(): int
{ {
try { try {
@ -268,10 +260,6 @@ class DownloadCommand extends BaseCommand
} }
} }
/**
* @throws RuntimeException
* @throws WrongUsageException
*/
private function downloadFromZip(string $path): int private function downloadFromZip(string $path): int
{ {
if (!file_exists($path)) { if (!file_exists($path)) {
@ -318,8 +306,6 @@ class DownloadCommand extends BaseCommand
* *
* @param array $extensions extension list * @param array $extensions extension list
* @param bool $include_suggests include suggested libs and extensions (default: true) * @param bool $include_suggests include suggested libs and extensions (default: true)
* @throws FileSystemException
* @throws WrongUsageException
*/ */
private function calculateSourcesByExt(array $extensions, bool $include_suggests = true): array private function calculateSourcesByExt(array $extensions, bool $include_suggests = true): array
{ {
@ -344,8 +330,6 @@ class DownloadCommand extends BaseCommand
* *
* @param array $libs library list * @param array $libs library list
* @param bool $include_suggests include suggested libs (default: true) * @param bool $include_suggests include suggested libs (default: true)
* @throws FileSystemException
* @throws WrongUsageException
*/ */
private function calculateSourcesByLib(array $libs, bool $include_suggests = true): array private function calculateSourcesByLib(array $libs, bool $include_suggests = true): array
{ {
@ -373,9 +357,6 @@ class DownloadCommand extends BaseCommand
return null; return null;
} }
/**
* @throws RuntimeException
*/
private function _clean(): int private function _clean(): int
{ {
logger()->warning('You are doing some operations that not recoverable: removing directories below'); logger()->warning('You are doing some operations that not recoverable: removing directories below');

View File

@ -4,9 +4,6 @@ declare(strict_types=1);
namespace SPC\command; namespace SPC\command;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\DependencyUtil; use SPC\util\DependencyUtil;
use SPC\util\LicenseDumper; use SPC\util\LicenseDumper;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
@ -27,11 +24,6 @@ class DumpLicenseCommand extends BaseCommand
$this->addOption('dump-dir', null, InputOption::VALUE_REQUIRED, 'Change dump directory', BUILD_ROOT_PATH . '/license'); $this->addOption('dump-dir', null, InputOption::VALUE_REQUIRED, 'Change dump directory', BUILD_ROOT_PATH . '/license');
} }
/**
* @throws WrongUsageException
* @throws FileSystemException
* @throws RuntimeException
*/
public function handle(): int public function handle(): int
{ {
$dumper = new LicenseDumper(); $dumper = new LicenseDumper();

View File

@ -5,9 +5,6 @@ declare(strict_types=1);
namespace SPC\command; namespace SPC\command;
use SPC\builder\traits\UnixSystemUtilTrait; use SPC\builder\traits\UnixSystemUtilTrait;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\SourceManager; use SPC\store\SourceManager;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
@ -23,11 +20,6 @@ class ExtractCommand extends BaseCommand
$this->addOption('source-only', null, null, 'Only check the source exist, do not check the lib and ext'); $this->addOption('source-only', null, null, 'Only check the source exist, do not check the lib and ext');
} }
/**
* @throws WrongUsageException
* @throws FileSystemException
* @throws RuntimeException
*/
public function handle(): int public function handle(): int
{ {
$sources = array_map('trim', array_filter(explode(',', $this->getArgument('sources')))); $sources = array_map('trim', array_filter(explode(',', $this->getArgument('sources'))));

View File

@ -28,9 +28,6 @@ class InstallPkgCommand extends BaseCommand
$this->addOption('skip-extract', null, null, 'Skip package extraction, just download the package archive'); $this->addOption('skip-extract', null, null, 'Skip package extraction, just download the package archive');
} }
/**
* @throws FileSystemException
*/
public function handle(): int public function handle(): int
{ {
try { try {

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace SPC\command; namespace SPC\command;
use SPC\exception\RuntimeException;
use SPC\util\SPCConfigUtil; use SPC\util\SPCConfigUtil;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
@ -28,9 +27,6 @@ class SPCConfigCommand extends BaseCommand
$this->addOption('no-php', null, null, 'Do not link to PHP library'); $this->addOption('no-php', null, null, 'Do not link to PHP library');
} }
/**
* @throws RuntimeException
*/
public function handle(): int public function handle(): int
{ {
// transform string to array // transform string to array

View File

@ -5,8 +5,6 @@ declare(strict_types=1);
namespace SPC\command\dev; namespace SPC\command\dev;
use SPC\command\BaseCommand; use SPC\command\BaseCommand;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException; use SPC\exception\WrongUsageException;
use SPC\store\Config; use SPC\store\Config;
use SPC\util\DependencyUtil; use SPC\util\DependencyUtil;
@ -30,11 +28,6 @@ class AllExtCommand extends BaseCommand
); );
} }
/**
* @throws FileSystemException
* @throws WrongUsageException
* @throws RuntimeException
*/
public function handle(): int public function handle(): int
{ {
$extensions = array_map('trim', array_filter(explode(',', $this->getArgument('extensions') ?? ''))); $extensions = array_map('trim', array_filter(explode(',', $this->getArgument('extensions') ?? '')));

View File

@ -146,11 +146,6 @@ class PackLibCommand extends BuildCommand
} }
} }
/**
* @throws WrongUsageException
* @throws RuntimeException
* @throws FileSystemException
*/
private function sanityCheckLib(LibraryBase $lib): void private function sanityCheckLib(LibraryBase $lib): void
{ {
logger()->info('Sanity check for library ' . $lib->getName()); logger()->info('Sanity check for library ' . $lib->getName());

View File

@ -5,8 +5,6 @@ declare(strict_types=1);
namespace SPC\command\dev; namespace SPC\command\dev;
use SPC\command\BaseCommand; use SPC\command\BaseCommand;
use SPC\exception\FileSystemException;
use SPC\exception\ValidationException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\ConfigValidator; use SPC\util\ConfigValidator;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
@ -23,10 +21,6 @@ class SortConfigCommand extends BaseCommand
$this->addArgument('config-name', InputArgument::REQUIRED, 'Your config to be sorted, you can sort "lib", "source" and "ext".'); $this->addArgument('config-name', InputArgument::REQUIRED, 'Your config to be sorted, you can sort "lib", "source" and "ext".');
} }
/**
* @throws ValidationException
* @throws FileSystemException
*/
public function handle(): int public function handle(): int
{ {
switch ($name = $this->getArgument('config-name')) { switch ($name = $this->getArgument('config-name')) {

View File

@ -55,11 +55,6 @@ class LinuxMuslCheck
return CheckResult::fail('musl-cross-make is not installed on your system', 'fix-musl-cross-make'); return CheckResult::fail('musl-cross-make is not installed on your system', 'fix-musl-cross-make');
} }
/** @noinspection PhpUnused */
/**
* @throws DownloaderException
* @throws FileSystemException
*/
#[AsFixItem('fix-musl-wrapper')] #[AsFixItem('fix-musl-wrapper')]
public function fixMusl(): bool public function fixMusl(): bool
{ {
@ -94,11 +89,6 @@ class LinuxMuslCheck
} }
} }
/** @noinspection PhpUnused */
/**
* @throws FileSystemException
* @throws WrongUsageException
*/
#[AsFixItem('fix-musl-cross-make')] #[AsFixItem('fix-musl-cross-make')]
public function fixMuslCrossMake(): bool public function fixMuslCrossMake(): bool
{ {

View File

@ -114,10 +114,6 @@ class LinuxToolCheckList
return CheckResult::ok(); return CheckResult::ok();
} }
/**
* @throws RuntimeException
* @noinspection PhpUnused
*/
#[AsFixItem('install-linux-tools')] #[AsFixItem('install-linux-tools')]
public function fixBuildTools(array $distro, array $missing): bool public function fixBuildTools(array $distro, array $missing): bool
{ {

View File

@ -8,8 +8,6 @@ use SPC\doctor\AsCheckItem;
use SPC\doctor\AsFixItem; use SPC\doctor\AsFixItem;
use SPC\doctor\CheckResult; use SPC\doctor\CheckResult;
use SPC\doctor\OptionalCheck; use SPC\doctor\OptionalCheck;
use SPC\exception\FileSystemException;
use SPC\exception\WrongUsageException;
use SPC\store\PackageManager; use SPC\store\PackageManager;
use SPC\store\pkg\Zig; use SPC\store\pkg\Zig;
use SPC\toolchain\ZigToolchain; use SPC\toolchain\ZigToolchain;
@ -32,11 +30,6 @@ class ZigCheck
return CheckResult::fail('zig is not installed', 'install-zig'); return CheckResult::fail('zig is not installed', 'install-zig');
} }
/** @noinspection PhpUnused */
/**
* @throws FileSystemException
* @throws WrongUsageException
*/
#[AsFixItem('install-zig')] #[AsFixItem('install-zig')]
public function installZig(): bool public function installZig(): bool
{ {

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace SPC\store; namespace SPC\store;
use SPC\exception\FileSystemException;
use SPC\exception\WrongUsageException; use SPC\exception\WrongUsageException;
class Config class Config
@ -24,8 +23,6 @@ class Config
* *
* @param string $name The name of the pre-built configuration * @param string $name The name of the pre-built configuration
* @return mixed The pre-built configuration or null if not found * @return mixed The pre-built configuration or null if not found
* @throws WrongUsageException
* @throws FileSystemException
*/ */
public static function getPreBuilt(string $name): mixed public static function getPreBuilt(string $name): mixed
{ {
@ -55,7 +52,6 @@ class Config
* *
* @param string $name The name of the source * @param string $name The name of the source
* @return null|array The source configuration or null if not found * @return null|array The source configuration or null if not found
* @throws FileSystemException
*/ */
public static function getSource(string $name): ?array public static function getSource(string $name): ?array
{ {
@ -70,7 +66,6 @@ class Config
* *
* @param string $name The name of the package * @param string $name The name of the package
* @return null|array The package configuration or null if not found * @return null|array The package configuration or null if not found
* @throws FileSystemException
*/ */
public static function getPkg(string $name): ?array public static function getPkg(string $name): ?array
{ {
@ -88,8 +83,6 @@ class Config
* @param null|string $key The configuration key (static-libs, headers, lib-depends, lib-suggests, frameworks, bin) * @param null|string $key The configuration key (static-libs, headers, lib-depends, lib-suggests, frameworks, bin)
* @param mixed $default Default value if key not found * @param mixed $default Default value if key not found
* @return mixed The library configuration or default value * @return mixed The library configuration or default value
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public static function getLib(string $name, ?string $key = null, mixed $default = null) public static function getLib(string $name, ?string $key = null, mixed $default = null)
{ {
@ -125,7 +118,6 @@ class Config
* Get all library configurations * Get all library configurations
* *
* @return array All library configurations * @return array All library configurations
* @throws FileSystemException
*/ */
public static function getLibs(): array public static function getLibs(): array
{ {
@ -140,8 +132,6 @@ class Config
* *
* @param string $name The name of the extension * @param string $name The name of the extension
* @return null|array The extension target configuration or default ['static', 'shared'] * @return null|array The extension target configuration or default ['static', 'shared']
* @throws WrongUsageException
* @throws FileSystemException
*/ */
public static function getExtTarget(string $name): ?array public static function getExtTarget(string $name): ?array
{ {
@ -162,8 +152,6 @@ class Config
* @param null|string $key The configuration key (lib-depends, lib-suggests, ext-depends, ext-suggests, arg-type) * @param null|string $key The configuration key (lib-depends, lib-suggests, ext-depends, ext-suggests, arg-type)
* @param mixed $default Default value if key not found * @param mixed $default Default value if key not found
* @return mixed The extension configuration or default value * @return mixed The extension configuration or default value
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public static function getExt(string $name, ?string $key = null, mixed $default = null) public static function getExt(string $name, ?string $key = null, mixed $default = null)
{ {
@ -199,7 +187,6 @@ class Config
* Get all extension configurations * Get all extension configurations
* *
* @return array All extension configurations * @return array All extension configurations
* @throws FileSystemException
*/ */
public static function getExts(): array public static function getExts(): array
{ {
@ -213,7 +200,6 @@ class Config
* Get all source configurations * Get all source configurations
* *
* @return array All source configurations * @return array All source configurations
* @throws FileSystemException
*/ */
public static function getSources(): array public static function getSources(): array
{ {

View File

@ -23,8 +23,6 @@ class Downloader
* @param string $name Source name * @param string $name Source name
* @param array $source Source meta info: [repo] * @param array $source Source meta info: [repo]
* @return array<int, string> [url, filename] * @return array<int, string> [url, filename]
* @throws DownloaderException
* @throws RuntimeException
*/ */
public static function getLatestBitbucketTag(string $name, array $source): array public static function getLatestBitbucketTag(string $name, array $source): array
{ {
@ -60,7 +58,6 @@ class Downloader
* @param array $source Source meta info: [repo] * @param array $source Source meta info: [repo]
* @param string $type Type of tarball, default is 'releases' * @param string $type Type of tarball, default is 'releases'
* @return array<int, string> [url, filename] * @return array<int, string> [url, filename]
* @throws DownloaderException
*/ */
public static function getLatestGithubTarball(string $name, array $source, string $type = 'releases'): array public static function getLatestGithubTarball(string $name, array $source, string $type = 'releases'): array
{ {
@ -111,7 +108,6 @@ class Downloader
* @param array $source Source meta info: [repo, match] * @param array $source Source meta info: [repo, match]
* @param bool $match_result Whether to return matched result by `match` param (default: true) * @param bool $match_result Whether to return matched result by `match` param (default: true)
* @return array<int, string> When $match_result = true, and we matched, [url, filename]. Otherwise, [{asset object}. ...] * @return array<int, string> When $match_result = true, and we matched, [url, filename]. Otherwise, [{asset object}. ...]
* @throws DownloaderException
*/ */
public static function getLatestGithubRelease(string $name, array $source, bool $match_result = true): array public static function getLatestGithubRelease(string $name, array $source, bool $match_result = true): array
{ {
@ -153,7 +149,6 @@ class Downloader
* @param string $name Source name * @param string $name Source name
* @param array $source Source meta info: [filelist] * @param array $source Source meta info: [filelist]
* @return array<int, string> [url, filename] * @return array<int, string> [url, filename]
* @throws DownloaderException
*/ */
public static function getFromFileList(string $name, array $source): array public static function getFromFileList(string $name, array $source): array
{ {
@ -196,8 +191,6 @@ class Downloader
* @param int $download_as Download type constant * @param int $download_as Download type constant
* @param array $headers Optional HTTP headers * @param array $headers Optional HTTP headers
* @param array $hooks Optional curl hooks * @param array $hooks Optional curl hooks
* @throws DownloaderException
* @throws RuntimeException
*/ */
public static function downloadFile(string $name, string $url, string $filename, ?string $move_path = null, int $download_as = SPC_DOWNLOAD_SOURCE, array $headers = [], array $hooks = []): void public static function downloadFile(string $name, string $url, string $filename, ?string $move_path = null, int $download_as = SPC_DOWNLOAD_SOURCE, array $headers = [], array $hooks = []): void
{ {
@ -228,8 +221,6 @@ class Downloader
* @param null|string $move_path Optional move path after download * @param null|string $move_path Optional move path after download
* @param int $retries Number of retry attempts * @param int $retries Number of retry attempts
* @param int $lock_as Lock type constant * @param int $lock_as Lock type constant
* @throws DownloaderException
* @throws RuntimeException
*/ */
public static function downloadGit(string $name, string $url, string $branch, ?array $submodules = null, ?string $move_path = null, int $retries = 0, int $lock_as = SPC_DOWNLOAD_SOURCE): void public static function downloadGit(string $name, string $url, string $branch, ?array $submodules = null, ?string $move_path = null, int $retries = 0, int $lock_as = SPC_DOWNLOAD_SOURCE): void
{ {
@ -307,9 +298,6 @@ class Downloader
* extract-files: ?array<string, string> * extract-files: ?array<string, string>
* } $pkg Package config * } $pkg Package config
* @param bool $force Download all the time even if it exists * @param bool $force Download all the time even if it exists
* @throws DownloaderException
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public static function downloadPackage(string $name, ?array $pkg = null, bool $force = false): void public static function downloadPackage(string $name, ?array $pkg = null, bool $force = false): void
{ {
@ -430,9 +418,6 @@ class Downloader
* } $source source meta info: [type, path, rev, url, filename, regex, license] * } $source source meta info: [type, path, rev, url, filename, regex, license]
* @param bool $force Whether to force download (default: false) * @param bool $force Whether to force download (default: false)
* @param int $download_as Lock source type (default: SPC_LOCK_SOURCE) * @param int $download_as Lock source type (default: SPC_LOCK_SOURCE)
* @throws DownloaderException
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public static function downloadSource(string $name, ?array $source = null, bool $force = false, int $download_as = SPC_DOWNLOAD_SOURCE): void public static function downloadSource(string $name, ?array $source = null, bool $force = false, int $download_as = SPC_DOWNLOAD_SOURCE): void
{ {
@ -538,8 +523,6 @@ class Downloader
* @param array $hooks Curl hooks * @param array $hooks Curl hooks
* @param int $retries Number of retry attempts * @param int $retries Number of retry attempts
* @return string Response body * @return string Response body
* @throws DownloaderException
* @throws RuntimeException
*/ */
public static function curlExec(string $url, string $method = 'GET', array $headers = [], array $hooks = [], int $retries = 0): string public static function curlExec(string $url, string $method = 'GET', array $headers = [], array $hooks = [], int $retries = 0): string
{ {
@ -597,9 +580,6 @@ class Downloader
* @param array $headers HTTP headers * @param array $headers HTTP headers
* @param array $hooks Curl hooks * @param array $hooks Curl hooks
* @param int $retries Number of retry attempts * @param int $retries Number of retry attempts
* @throws DownloaderException
* @throws RuntimeException
* @throws WrongUsageException
*/ */
public static function curlDown(string $url, string $path, string $method = 'GET', array $headers = [], array $hooks = [], int $retries = 0): void public static function curlDown(string $url, string $path, string $method = 'GET', array $headers = [], array $hooks = [], int $retries = 0): void
{ {
@ -705,10 +685,6 @@ class Downloader
return intval(getenv('SPC_DOWNLOAD_RETRIES') ?: 0); return intval(getenv('SPC_DOWNLOAD_RETRIES') ?: 0);
} }
/**
* @throws FileSystemException
* @throws WrongUsageException
*/
private static function isAlreadyDownloaded(string $name, bool $force, int $download_as = SPC_DOWNLOAD_SOURCE): bool private static function isAlreadyDownloaded(string $name, bool $force, int $download_as = SPC_DOWNLOAD_SOURCE): bool
{ {
// If the lock file exists, skip downloading for source mode // If the lock file exists, skip downloading for source mode

View File

@ -17,7 +17,6 @@ class FileSystem
* @param string $config The configuration name (ext, lib, source, pkg, pre-built) * @param string $config The configuration name (ext, lib, source, pkg, pre-built)
* @param null|string $config_dir Optional custom config directory * @param null|string $config_dir Optional custom config directory
* @return array The loaded configuration array * @return array The loaded configuration array
* @throws FileSystemException
*/ */
public static function loadConfigArray(string $config, ?string $config_dir = null): array public static function loadConfigArray(string $config, ?string $config_dir = null): array
{ {
@ -46,7 +45,6 @@ class FileSystem
* *
* @param string $filename The file path to read * @param string $filename The file path to read
* @return string The file contents * @return string The file contents
* @throws FileSystemException
*/ */
public static function readFile(string $filename): string public static function readFile(string $filename): string
{ {
@ -65,7 +63,6 @@ class FileSystem
* @param mixed $search The search string * @param mixed $search The search string
* @param mixed $replace The replacement string * @param mixed $replace The replacement string
* @return false|int Number of replacements or false on failure * @return false|int Number of replacements or false on failure
* @throws FileSystemException
*/ */
public static function replaceFileStr(string $filename, mixed $search = null, mixed $replace = null): false|int public static function replaceFileStr(string $filename, mixed $search = null, mixed $replace = null): false|int
{ {
@ -79,7 +76,6 @@ class FileSystem
* @param mixed $search The regex pattern * @param mixed $search The regex pattern
* @param mixed $replace The replacement string * @param mixed $replace The replacement string
* @return false|int Number of replacements or false on failure * @return false|int Number of replacements or false on failure
* @throws FileSystemException
*/ */
public static function replaceFileRegex(string $filename, mixed $search = null, mixed $replace = null): false|int public static function replaceFileRegex(string $filename, mixed $search = null, mixed $replace = null): false|int
{ {
@ -92,7 +88,6 @@ class FileSystem
* @param string $filename The file path * @param string $filename The file path
* @param mixed $callback The callback function * @param mixed $callback The callback function
* @return false|int Number of replacements or false on failure * @return false|int Number of replacements or false on failure
* @throws FileSystemException
*/ */
public static function replaceFileUser(string $filename, mixed $callback = null): false|int public static function replaceFileUser(string $filename, mixed $callback = null): false|int
{ {
@ -149,7 +144,6 @@ class FileSystem
* *
* @param string $from Source directory path * @param string $from Source directory path
* @param string $to Destination directory path * @param string $to Destination directory path
* @throws RuntimeException
*/ */
public static function copyDir(string $from, string $to): void public static function copyDir(string $from, string $to): void
{ {
@ -174,8 +168,6 @@ class FileSystem
* @param string $source_type Archive type (tar.gz, zip, etc.) * @param string $source_type Archive type (tar.gz, zip, etc.)
* @param string $filename Archive filename * @param string $filename Archive filename
* @param null|string $extract_path Optional extraction path * @param null|string $extract_path Optional extraction path
* @throws RuntimeException
* @throws FileSystemException
*/ */
public static function extractPackage(string $name, string $source_type, string $filename, ?string $extract_path = null): void public static function extractPackage(string $name, string $source_type, string $filename, ?string $extract_path = null): void
{ {
@ -212,8 +204,6 @@ class FileSystem
* @param string $source_type Archive type (tar.gz, zip, etc.) * @param string $source_type Archive type (tar.gz, zip, etc.)
* @param string $filename Archive filename * @param string $filename Archive filename
* @param null|string $move_path Optional move path * @param null|string $move_path Optional move path
* @throws FileSystemException
* @throws RuntimeException
*/ */
public static function extractSource(string $name, string $source_type, string $filename, ?string $move_path = null): void public static function extractSource(string $name, string $source_type, string $filename, ?string $move_path = null): void
{ {
@ -413,7 +403,6 @@ class FileSystem
* Create directory recursively * Create directory recursively
* *
* @param string $path Directory path to create * @param string $path Directory path to create
* @throws FileSystemException
*/ */
public static function createDir(string $path): void public static function createDir(string $path): void
{ {
@ -429,7 +418,6 @@ class FileSystem
* @param mixed $content Content to write * @param mixed $content Content to write
* @param mixed ...$args Additional arguments passed to file_put_contents * @param mixed ...$args Additional arguments passed to file_put_contents
* @return bool|int|string Result of file writing operation * @return bool|int|string Result of file writing operation
* @throws FileSystemException
*/ */
public static function writeFile(string $path, mixed $content, ...$args): bool|int|string public static function writeFile(string $path, mixed $content, ...$args): bool|int|string
{ {
@ -444,7 +432,6 @@ class FileSystem
* Reset directory by removing and recreating it * Reset directory by removing and recreating it
* *
* @param string $dir_name Directory name * @param string $dir_name Directory name
* @throws FileSystemException
*/ */
public static function resetDir(string $dir_name): void public static function resetDir(string $dir_name): void
{ {
@ -544,7 +531,6 @@ class FileSystem
* @param string $find String to find in line * @param string $find String to find in line
* @param string $line New line content * @param string $line New line content
* @return false|int Number of replacements or false on failure * @return false|int Number of replacements or false on failure
* @throws FileSystemException
*/ */
public static function replaceFileLineContainsString(string $file, string $find, string $line): false|int public static function replaceFileLineContainsString(string $file, string $find, string $line): false|int
{ {
@ -560,10 +546,6 @@ class FileSystem
return file_put_contents($file, implode('', $lines)); return file_put_contents($file, implode('', $lines));
} }
/**
* @throws RuntimeException
* @throws FileSystemException
*/
private static function extractArchive(string $filename, string $target): void private static function extractArchive(string $filename, string $target): void
{ {
// Create base dir // Create base dir
@ -600,9 +582,6 @@ class FileSystem
} }
} }
/**
* @throws FileSystemException
*/
private static function replaceFile(string $filename, int $replace_type = REPLACE_FILE_STR, mixed $callback_or_search = null, mixed $to_replace = null): false|int private static function replaceFile(string $filename, int $replace_type = REPLACE_FILE_STR, mixed $callback_or_search = null, mixed $to_replace = null): false|int
{ {
logger()->debug('Replacing file with type[' . $replace_type . ']: ' . $filename); logger()->debug('Replacing file with type[' . $replace_type . ']: ' . $filename);

View File

@ -62,8 +62,6 @@ class LockFile
* *
* @param string $lock_name Lock name to set or remove * @param string $lock_name Lock name to set or remove
* @param null|array $lock_content lock content to set, or null to remove the lock entry * @param null|array $lock_content lock content to set, or null to remove the lock entry
* @throws FileSystemException
* @throws WrongUsageException
*/ */
public static function put(string $lock_name, ?array $lock_content): void public static function put(string $lock_name, ?array $lock_content): void
{ {
@ -86,7 +84,6 @@ class LockFile
* *
* @param array $lock_options lock item options, must contain 'source_type', 'filename' or 'dirname' * @param array $lock_options lock item options, must contain 'source_type', 'filename' or 'dirname'
* @return string the absolute path to the lock file or directory * @return string the absolute path to the lock file or directory
* @throws WrongUsageException
*/ */
public static function getLockFullPath(array $lock_options): string public static function getLockFullPath(array $lock_options): string
{ {
@ -124,7 +121,6 @@ class LockFile
* *
* @param array $lock_options Lock options * @param array $lock_options Lock options
* @return string Hash of the lock source * @return string Hash of the lock source
* @throws RuntimeException
*/ */
public static function getLockSourceHash(array $lock_options): string public static function getLockSourceHash(array $lock_options): string
{ {
@ -143,8 +139,6 @@ class LockFile
/** /**
* @param array $lock_options Lock options * @param array $lock_options Lock options
* @param string $destination Target directory * @param string $destination Target directory
* @throws FileSystemException
* @throws RuntimeException
*/ */
public static function putLockSourceHash(array $lock_options, string $destination): void public static function putLockSourceHash(array $lock_options, string $destination): void
{ {
@ -167,9 +161,6 @@ class LockFile
* move_path: ?string, * move_path: ?string,
* lock_as: int * lock_as: int
* } $data Source data * } $data Source data
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/ */
public static function lockSource(string $name, array $data): void public static function lockSource(string $name, array $data): void
{ {
@ -201,8 +192,6 @@ class LockFile
* Remove the lock file or directory if it exists. * Remove the lock file or directory if it exists.
* *
* @param array $lock_options lock item options, must contain 'source_type', 'filename' or 'dirname' * @param array $lock_options lock item options, must contain 'source_type', 'filename' or 'dirname'
* @throws WrongUsageException
* @throws FileSystemException
*/ */
private static function removeLockFileIfExists(array $lock_options): void private static function removeLockFileIfExists(array $lock_options): void
{ {

View File

@ -4,17 +4,10 @@ declare(strict_types=1);
namespace SPC\store; namespace SPC\store;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException; use SPC\exception\WrongUsageException;
class SourceManager class SourceManager
{ {
/**
* @throws WrongUsageException
* @throws FileSystemException
* @throws RuntimeException
*/
public static function initSource(?array $sources = null, ?array $libs = null, ?array $exts = null, bool $source_only = false): void public static function initSource(?array $sources = null, ?array $libs = null, ?array $exts = null, bool $source_only = false): void
{ {
$sources_extracted = []; $sources_extracted = [];

View File

@ -34,14 +34,6 @@ class SourcePatcher
FileSystem::addSourceExtractHook('gmssl', [__CLASS__, 'patchGMSSL']); FileSystem::addSourceExtractHook('gmssl', [__CLASS__, 'patchGMSSL']);
} }
/**
* Source patcher runner before buildconf
*
* @param BuilderBase $builder Builder
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public static function patchBeforeBuildconf(BuilderBase $builder): void public static function patchBeforeBuildconf(BuilderBase $builder): void
{ {
foreach ($builder->getExts() as $ext) { foreach ($builder->getExts() as $ext) {
@ -112,7 +104,6 @@ class SourcePatcher
* Source patcher runner before configure * Source patcher runner before configure
* *
* @param BuilderBase $builder Builder * @param BuilderBase $builder Builder
* @throws FileSystemException
*/ */
public static function patchBeforeConfigure(BuilderBase $builder): void public static function patchBeforeConfigure(BuilderBase $builder): void
{ {
@ -138,10 +129,6 @@ class SourcePatcher
} }
} }
/**
* @throws RuntimeException
* @throws FileSystemException
*/
public static function patchMicro(?array $items = null): bool public static function patchMicro(?array $items = null): bool
{ {
if (!file_exists(SOURCE_PATH . '/php-src/sapi/micro/php_micro.c')) { if (!file_exists(SOURCE_PATH . '/php-src/sapi/micro/php_micro.c')) {
@ -201,7 +188,6 @@ class SourcePatcher
* @param string $patch_name Patch file name in src/globals/patch/ or absolute path * @param string $patch_name Patch file name in src/globals/patch/ or absolute path
* @param string $cwd Working directory for patch command * @param string $cwd Working directory for patch command
* @param bool $reverse Reverse patches (default: False) * @param bool $reverse Reverse patches (default: False)
* @throws RuntimeException
*/ */
public static function patchFile(string $patch_name, string $cwd, bool $reverse = false): bool public static function patchFile(string $patch_name, string $cwd, bool $reverse = false): bool
{ {
@ -247,9 +233,6 @@ class SourcePatcher
return true; return true;
} }
/**
* @throws FileSystemException
*/
public static function patchOpenssl11Darwin(): bool public static function patchOpenssl11Darwin(): bool
{ {
if (PHP_OS_FAMILY === 'Darwin' && !file_exists(SOURCE_PATH . '/openssl/VERSION.dat') && file_exists(SOURCE_PATH . '/openssl/test/v3ext.c')) { if (PHP_OS_FAMILY === 'Darwin' && !file_exists(SOURCE_PATH . '/openssl/VERSION.dat') && file_exists(SOURCE_PATH . '/openssl/test/v3ext.c')) {
@ -259,9 +242,6 @@ class SourcePatcher
return false; return false;
} }
/**
* @throws FileSystemException
*/
public static function patchSwoole(): bool public static function patchSwoole(): bool
{ {
// swoole hook needs pdo/pdo.h // swoole hook needs pdo/pdo.h
@ -288,9 +268,6 @@ class SourcePatcher
return true; return true;
} }
/**
* @throws FileSystemException
*/
public static function patchBeforeMake(BuilderBase $builder): void public static function patchBeforeMake(BuilderBase $builder): void
{ {
if ($builder instanceof UnixBuilderBase) { if ($builder instanceof UnixBuilderBase) {
@ -343,9 +320,6 @@ class SourcePatcher
} }
} }
/**
* @throws FileSystemException
*/
public static function patchHardcodedINI(array $ini = []): bool public static function patchHardcodedINI(array $ini = []): bool
{ {
$cli_c = SOURCE_PATH . '/php-src/sapi/cli/php_cli.c'; $cli_c = SOURCE_PATH . '/php-src/sapi/cli/php_cli.c';
@ -403,9 +377,6 @@ class SourcePatcher
return $result; return $result;
} }
/**
* @throws FileSystemException
*/
public static function patchMicroPhar(int $version_id): void public static function patchMicroPhar(int $version_id): void
{ {
FileSystem::backupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c'); FileSystem::backupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c');
@ -431,9 +402,6 @@ class SourcePatcher
} }
} }
/**
* @throws RuntimeException
*/
public static function unpatchMicroPhar(): void public static function unpatchMicroPhar(): void
{ {
FileSystem::restoreBackupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c'); FileSystem::restoreBackupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c');
@ -441,8 +409,6 @@ class SourcePatcher
/** /**
* Fix the compilation issue of sqlsrv and pdo_sqlsrv on Windows (/sdl check is too strict and will cause Zend compilation to fail) * Fix the compilation issue of sqlsrv and pdo_sqlsrv on Windows (/sdl check is too strict and will cause Zend compilation to fail)
*
* @throws FileSystemException
*/ */
public static function patchSQLSRVWin32(string $source_name): bool public static function patchSQLSRVWin32(string $source_name): bool
{ {
@ -542,9 +508,6 @@ class SourcePatcher
/** /**
* Patch cli SAPI Makefile for Windows. * Patch cli SAPI Makefile for Windows.
*
* @throws FileSystemException
* @throws RuntimeException
*/ */
public static function patchWindowsCLITarget(): void public static function patchWindowsCLITarget(): void
{ {
@ -568,9 +531,6 @@ class SourcePatcher
FileSystem::writeFile(SOURCE_PATH . '/php-src/Makefile', implode("\r\n", $lines)); FileSystem::writeFile(SOURCE_PATH . '/php-src/Makefile', implode("\r\n", $lines));
} }
/**
* @throws RuntimeException
*/
public static function patchPhpLibxml212(): bool public static function patchPhpLibxml212(): bool
{ {
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h'); $file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
@ -595,9 +555,6 @@ class SourcePatcher
return false; return false;
} }
/**
* @throws FileSystemException
*/
public static function patchGDWin32(): bool public static function patchGDWin32(): bool
{ {
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h'); $file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
@ -617,8 +574,6 @@ class SourcePatcher
/** /**
* Add additional `static-php-cli.version` ini value for PHP source. * Add additional `static-php-cli.version` ini value for PHP source.
*
* @throws FileSystemException
*/ */
public static function patchSPCVersionToPHP(string $version = 'unknown'): void public static function patchSPCVersionToPHP(string $version = 'unknown'): void
{ {
@ -631,9 +586,6 @@ class SourcePatcher
} }
} }
/**
* @throws FileSystemException
*/
public static function patchMicroWin32(): void public static function patchMicroWin32(): void
{ {
// patch micro win32 // patch micro win32

Some files were not shown because too many files have changed in this diff Show More