mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-22 00:05:37 +08:00
Add builder options for build:libs command
This commit is contained in:
@@ -4,8 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace StaticPHP\Command;
|
namespace StaticPHP\Command;
|
||||||
|
|
||||||
|
use StaticPHP\Package\PackageInstaller;
|
||||||
|
use StaticPHP\Util\V2CompatLayer;
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
|
||||||
#[AsCommand('build:libs', 'Build specified library packages')]
|
#[AsCommand('build:libs', 'Build specified library packages')]
|
||||||
class BuildLibsCommand extends BaseCommand
|
class BuildLibsCommand extends BaseCommand
|
||||||
@@ -13,13 +16,20 @@ class BuildLibsCommand extends BaseCommand
|
|||||||
public function configure(): void
|
public function configure(): void
|
||||||
{
|
{
|
||||||
$this->addArgument('libraries', InputArgument::REQUIRED, 'The library packages will be compiled, comma separated');
|
$this->addArgument('libraries', InputArgument::REQUIRED, 'The library packages will be compiled, comma separated');
|
||||||
|
// Builder options
|
||||||
|
$this->getDefinition()->addOptions([
|
||||||
|
new InputOption('with-suggests', ['L', 'E'], null, 'Resolve and install suggested packages as well'),
|
||||||
|
new InputOption('with-packages', null, InputOption::VALUE_REQUIRED, 'add additional packages to install/build, comma separated', ''),
|
||||||
|
new InputOption('no-download', null, null, 'Skip downloading artifacts (use existing cached files)'),
|
||||||
|
...V2CompatLayer::getLegacyBuildOptions(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(): int
|
public function handle(): int
|
||||||
{
|
{
|
||||||
$libs = parse_comma_list($this->input->getArgument('libraries'));
|
$libs = parse_comma_list($this->input->getArgument('libraries'));
|
||||||
|
|
||||||
$installer = new \StaticPHP\Package\PackageInstaller($this->input->getOptions());
|
$installer = new PackageInstaller($this->input->getOptions());
|
||||||
foreach ($libs as $lib) {
|
foreach ($libs as $lib) {
|
||||||
$installer->addBuildPackage($lib);
|
$installer->addBuildPackage($lib);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user