From fcaa7c5f429c486dc8dc9ca9f97034610d0171be Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 29 Jun 2025 16:21:22 +0800 Subject: [PATCH] Add no-env-check for builder --- src/SPC/builder/macos/MacOSBuilder.php | 5 ++++- src/SPC/command/BaseCommand.php | 2 ++ src/SPC/command/CraftCommand.php | 2 +- src/SPC/command/SPCConfigCommand.php | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/SPC/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index 362a68fe..319047a4 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -29,7 +29,10 @@ class MacOSBuilder extends UnixBuilderBase // apply global environment variables GlobalEnvManager::init(); - GlobalEnvManager::afterInit(); + + if (!$this->getOption('no-env-check')) { + GlobalEnvManager::afterInit(); + } // ---------- set necessary compile vars ---------- // concurrency diff --git a/src/SPC/command/BaseCommand.php b/src/SPC/command/BaseCommand.php index 832ced97..251fcdb5 100644 --- a/src/SPC/command/BaseCommand.php +++ b/src/SPC/command/BaseCommand.php @@ -32,6 +32,7 @@ abstract class BaseCommand extends Command parent::__construct($name); $this->addOption('debug', null, null, 'Enable debug mode'); $this->addOption('no-motd', null, null, 'Disable motd'); + $this->addOption('no-env-check', null, null, 'Disable env check for builder'); } public function initialize(InputInterface $input, OutputInterface $output): void @@ -99,6 +100,7 @@ abstract class BaseCommand extends Command // init GlobalEnv if (!$this instanceof BuildCommand) { GlobalEnvManager::init(); + $this->input->setOption('no-env-check', true); } if ($this->shouldExecute()) { try { diff --git a/src/SPC/command/CraftCommand.php b/src/SPC/command/CraftCommand.php index c8003a3e..fbf3a5be 100644 --- a/src/SPC/command/CraftCommand.php +++ b/src/SPC/command/CraftCommand.php @@ -10,7 +10,7 @@ use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Process\Process; #[AsCommand('craft', 'Build static-php from craft.yml')] -class CraftCommand extends BaseCommand +class CraftCommand extends BuildCommand { public function configure(): void { diff --git a/src/SPC/command/SPCConfigCommand.php b/src/SPC/command/SPCConfigCommand.php index d3c7a0b2..a1886ed1 100644 --- a/src/SPC/command/SPCConfigCommand.php +++ b/src/SPC/command/SPCConfigCommand.php @@ -11,7 +11,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; #[AsCommand('spc-config', 'Build dependencies')] -class SPCConfigCommand extends BuildCommand +class SPCConfigCommand extends BaseCommand { protected bool $no_motd = true;