34 lines
850 B
PHP
34 lines
850 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
$manifest = require dirname(__DIR__) . '/manifest.php';
|
|
$paths = array_slice($argv, 1);
|
|
$shared = [
|
|
'library.json',
|
|
'composer.json',
|
|
'tests/Symcon/TestContext.php',
|
|
'tests/Symcon/TestRunner.php',
|
|
'tests/Symcon/bootstrap.php',
|
|
'tests/Symcon/manifest.php',
|
|
];
|
|
$selected = [];
|
|
|
|
foreach ($paths as $path) {
|
|
$path = ltrim(str_replace('\\', '/', $path), './');
|
|
if (in_array($path, $shared, true)) {
|
|
$selected = array_keys($manifest);
|
|
break;
|
|
}
|
|
foreach ($manifest as $name => $definition) {
|
|
foreach ($definition['paths'] as $pattern) {
|
|
if (fnmatch($pattern, $path)) {
|
|
$selected[] = $name;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
echo json_encode(array_values(array_unique($selected)), JSON_THROW_ON_ERROR) . PHP_EOL;
|