Add php and lib-base as special libraries to add dependencies to the root node (#618)

* Remove E_STRICT

* Add lib-base and php as special libs

* Remove debug code

* Fix phpunit with new config structure

* Fix phpunit test and fix license dumper bug for new type of lib

* Add missing lib type filter for windows builder
This commit is contained in:
Jerry Ma
2025-03-08 14:29:44 +08:00
committed by GitHub
parent 15c7e41501
commit d30d1fc447
18 changed files with 138 additions and 34 deletions

View File

@@ -33,7 +33,17 @@ class SortConfigCommand extends BaseCommand
case 'lib':
$file = json_decode(FileSystem::readFile(ROOT_DIR . '/config/lib.json'), true);
ConfigValidator::validateLibs($file);
ksort($file);
uksort($file, function ($a, $b) use ($file) {
$type_a = $file[$a]['type'] ?? 'lib';
$type_b = $file[$b]['type'] ?? 'lib';
$type_order = ['root', 'target', 'package', 'lib'];
// compare type first
if ($type_a !== $type_b) {
return array_search($type_a, $type_order) <=> array_search($type_b, $type_order);
}
// compare name
return $a <=> $b;
});
if (!file_put_contents(ROOT_DIR . '/config/lib.json', json_encode($file, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "\n")) {
$this->output->writeln('<error>Write file lib.json failed!</error>');
return static::FAILURE;