mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-08 17:35:36 +08:00
Enhance musl-wrapper and musl-toolchain installation process (#988)
This commit is contained in:
@@ -34,7 +34,7 @@ readonly class Doctor
|
||||
InteractiveTerm::notice('Starting doctor checks ...');
|
||||
}
|
||||
foreach ($this->getValidCheckList() as $check) {
|
||||
if (!$this->checkItem($check)) {
|
||||
if (!$this->checkItem($check, $interactive)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ readonly class Doctor
|
||||
* @param CheckItem|string $check The check item to be checked
|
||||
* @return bool True if the check passed or was fixed, false otherwise
|
||||
*/
|
||||
public function checkItem(CheckItem|string $check): bool
|
||||
public function checkItem(CheckItem|string $check, bool $interactive = true): bool
|
||||
{
|
||||
if (is_string($check)) {
|
||||
$found = null;
|
||||
@@ -63,7 +63,8 @@ readonly class Doctor
|
||||
}
|
||||
$check = $found;
|
||||
}
|
||||
$this->output?->write("Checking <comment>{$check->item_name}</comment> ... ");
|
||||
$prepend = $interactive ? ' - ' : '';
|
||||
$this->output?->write("{$prepend}Checking <comment>{$check->item_name}</comment> ... ");
|
||||
|
||||
// call check
|
||||
$result = call_user_func($check->callback);
|
||||
|
||||
@@ -13,6 +13,7 @@ use StaticPHP\Attribute\Doctor\OptionalCheck;
|
||||
use StaticPHP\DI\ApplicationContext;
|
||||
use StaticPHP\Doctor\CheckResult;
|
||||
use StaticPHP\Runtime\Shell\Shell;
|
||||
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
||||
use StaticPHP\Toolchain\MuslToolchain;
|
||||
use StaticPHP\Toolchain\ZigToolchain;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
@@ -25,8 +26,8 @@ class LinuxMuslCheck
|
||||
{
|
||||
public static function optionalCheck(): bool
|
||||
{
|
||||
return getenv('SPC_TOOLCHAIN') === MuslToolchain::class ||
|
||||
(getenv('SPC_TOOLCHAIN') === ZigToolchain::class && !LinuxUtil::isMuslDist());
|
||||
$toolchain = ApplicationContext::get(ToolchainInterface::class);
|
||||
return $toolchain instanceof MuslToolchain || $toolchain instanceof ZigToolchain && !LinuxUtil::isMuslDist();
|
||||
}
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
|
||||
Reference in New Issue
Block a user