44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace VersaDigitale\Platform\Console\Commands\Development;
|
|
|
|
use Secondtruth\Compiler\Compiler;
|
|
use Symfony\Component\Console\Attribute\AsCommand;
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
#[AsCommand(name: 'dev:compile')]
|
|
class CompilePlatformCommand extends Command
|
|
{
|
|
|
|
protected function configure(): void
|
|
{
|
|
$this->setDescription('Kompliliert die Platform und erstellt die .phar Datei');
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
{
|
|
// Deine Logik für den Compiler
|
|
$output->writeln("Kompiliere die Platform...");
|
|
|
|
// mkdirs
|
|
if (!is_dir(__DIR__ . "/../../../../" . 'build')) {
|
|
mkdir(__DIR__ . "/../../../../" .'build');
|
|
}
|
|
|
|
$compiler = new Compiler(__DIR__ . "/../../../../");
|
|
|
|
$compiler->addIndexFile("versa");
|
|
$compiler->addFile("composer.json");
|
|
$compiler->addDirectory("src", '!*.php');
|
|
$compiler->addDirectory("vendor");
|
|
|
|
$compiler->compile("build/versa.phar");
|
|
|
|
$output->writeln('Die .phar Datei wurde erfolgreich erstellt.');
|
|
|
|
return Command::SUCCESS;
|
|
}
|
|
|
|
} |