Add PackageInfoCommand to display package configuration information and support status

This commit is contained in:
crazywhalecc
2026-02-27 09:50:21 +08:00
parent cfce177070
commit 28c82b811b
5 changed files with 260 additions and 0 deletions

View File

@@ -138,6 +138,16 @@ abstract class Package
return $this->stages;
}
/**
* Get the list of OS families that have a registered build function (via #[BuildFor]).
*
* @return string[] e.g. ['Linux', 'Darwin']
*/
public function getBuildForOSList(): array
{
return array_keys($this->build_functions);
}
/**
* Check if the package has a specific stage defined.
*

View File

@@ -280,6 +280,27 @@ class PhpExtensionPackage extends Package
$builder->deployBinary($soFile, $soFile, false);
}
/**
* Get per-OS build support status for this php-extension.
*
* Rules (same as v2):
* - OS not listed in 'support' config => 'yes' (fully supported)
* - OS listed with 'wip' => 'wip'
* - OS listed with 'partial' => 'partial'
* - OS listed with 'no' => 'no'
*
* @return array<string, string> e.g. ['Linux' => 'yes', 'Darwin' => 'partial', 'Windows' => 'no']
*/
public function getBuildSupportStatus(): array
{
$exceptions = $this->extension_config['support'] ?? [];
$result = [];
foreach (['Linux', 'Darwin', 'Windows'] as $os) {
$result[$os] = $exceptions[$os] ?? 'yes';
}
return $result;
}
/**
* Register default stages if not already defined by attributes.
* This is called after all attributes have been loaded.