Add no-env-check for builder

This commit is contained in:
crazywhalecc 2025-06-29 16:21:22 +08:00
parent e36800b951
commit fcaa7c5f42
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
4 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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
{

View File

@ -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;