Skip to content

Commit dd5762f

Browse files
committed
Add lib skeleton command and sort config, spc_mode suuport, etc...
1 parent 1707c67 commit dd5762f

19 files changed

+865
-108
lines changed

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
parameters:
22
reportUnmatchedIgnoredErrors: false
33
level: 4
4+
phpVersion: 80400
45
paths:
56
- ./src/
67
ignoreErrors:

skeleton-test.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
<?php
22

3+
declare(strict_types=1);
4+
5+
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
36
use StaticPHP\Skeleton\ArtifactGenerator;
7+
use StaticPHP\Skeleton\ExecutorGenerator;
48
use StaticPHP\Skeleton\PackageGenerator;
59

6-
710
require_once 'vendor/autoload.php';
811

912
$package_generator = new PackageGenerator('foo', 'library')
1013
->addDependency('bar')
1114
->addStaticLib('libfoo.a', 'unix')
1215
->addStaticLib('libfoo.a', 'unix')
13-
->addArtifact($artifact_generator = new ArtifactGenerator('foo')->setSource(['type' => 'url', 'url' => 'https://example.com/foo.tar.gz']));
16+
->addArtifact($artifact_generator = new ArtifactGenerator('foo')->setSource(['type' => 'url', 'url' => 'https://example.com/foo.tar.gz']))
17+
->enableBuild(['Darwin', 'Linux'], 'build')
18+
->addFunctionExecutorBinding('build', new ExecutorGenerator(UnixCMakeExecutor::class));
1419

15-
$pkg_config = $package_generator->generateConfig();
16-
$artifact_config = $artifact_generator->generateConfig();
20+
$pkg_config = $package_generator->generateConfigArray();
21+
$artifact_config = $artifact_generator->generateConfigArray();
1722

18-
echo "===== pkg.json =====" . PHP_EOL;
19-
echo json_encode($pkg_config, 64|128|256) . PHP_EOL;
20-
echo "===== artifact.json =====" . PHP_EOL;
21-
echo json_encode($artifact_config, 64|128|256) . PHP_EOL;
23+
echo '===== pkg.json =====' . PHP_EOL;
24+
echo json_encode($pkg_config, 64 | 128 | 256) . PHP_EOL;
25+
echo '===== artifact.json =====' . PHP_EOL;
26+
echo json_encode($artifact_config, 64 | 128 | 256) . PHP_EOL;
27+
echo '===== php code for package =====' . PHP_EOL;
28+
echo $package_generator->generatePackageClassFile('Package\Library');

src/Package/Artifact/zig.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use StaticPHP\Artifact\Downloader\DownloadResult;
99
use StaticPHP\Attribute\Artifact\AfterBinaryExtract;
1010
use StaticPHP\Attribute\Artifact\CustomBinary;
11-
use StaticPHP\Attribute\Artifact\CustomSource;
1211
use StaticPHP\Exception\DownloaderException;
1312
use StaticPHP\Runtime\SystemTarget;
1413

src/StaticPHP/Artifact/ArtifactDownloader.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,7 @@ public function download(bool $interactive = true): void
329329
}
330330
if ($interactive) {
331331
$skip_msg = !empty($skipped) ? ' (Skipped ' . count($skipped) . ' artifacts for being already downloaded)' : '';
332-
InteractiveTerm::success("Downloaded all {$count} artifacts.{$skip_msg}", true);
333-
echo PHP_EOL;
332+
InteractiveTerm::success("Downloaded all {$count} artifacts.{$skip_msg}\n", true);
334333
}
335334
}
336335
} catch (SPCException $e) {

src/StaticPHP/Command/BaseCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ abstract class BaseCommand extends Command
2323
\___ \| __/ _` | __| |/ __| |_) | |_| | |_) |
2424
___) | || (_| | |_| | (__| __/| _ | __/
2525
|____/ \__\__,_|\__|_|\___|_| |_| |_|_| {version}
26-
2726
';
2827

2928
protected bool $no_motd = false;
@@ -71,7 +70,7 @@ public function initialize(InputInterface $input, OutputInterface $output): void
7170
$version = $this->getVersionWithCommit();
7271
if (!$this->no_motd) {
7372
$str = str_replace('{version}', '' . ConsoleColor::none("v{$version}"), '' . ConsoleColor::magenta(self::$motd));
74-
echo $this->input->getOption('no-ansi') ? strip_ansi_colors($str) : $str;
73+
$this->output->writeln($this->input->getOption('no-ansi') ? strip_ansi_colors($str) : $str);
7574
}
7675
}
7776

0 commit comments

Comments
 (0)