mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
add builder provider
This commit is contained in:
parent
db75b18da4
commit
65d38d5efc
42
src/SPC/builder/BuilderProvider.php
Normal file
42
src/SPC/builder/BuilderProvider.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder;
|
||||
|
||||
use SPC\builder\linux\LinuxBuilder;
|
||||
use SPC\builder\macos\MacOSBuilder;
|
||||
use SPC\builder\windows\WindowsBuilder;
|
||||
use SPC\exception\RuntimeException;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
||||
/**
|
||||
* 用于生成对应系统环境的 Builder 对象的类
|
||||
*/
|
||||
class BuilderProvider
|
||||
{
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public static function makeBuilderByInput(InputInterface $input): BuilderBase
|
||||
{
|
||||
return match (PHP_OS_FAMILY) {
|
||||
// 'Windows' => new WindowsBuilder(
|
||||
// binary_sdk_dir: $input->getOption('with-sdk-binary-dir'),
|
||||
// vs_ver: $input->getOption('vs-ver'),
|
||||
// arch: $input->getOption('arch'),
|
||||
// ),
|
||||
'Darwin' => new MacOSBuilder(
|
||||
cc: $input->getOption('cc'),
|
||||
cxx: $input->getOption('cxx'),
|
||||
arch: $input->getOption('arch'),
|
||||
),
|
||||
// 'Linux' => new LinuxBuilder(
|
||||
// cc: $input->getOption('cc'),
|
||||
// cxx: $input->getOption('cxx'),
|
||||
// arch: $input->getOption('arch'),
|
||||
// ),
|
||||
default => throw new RuntimeException('Current OS is not supported yet'),
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user