Merge pull request #802 from crazywhalecc/feat/safe-pack

Check lib-suggest before packing libs
This commit is contained in:
Jerry Ma 2025-07-17 13:34:15 +08:00 committed by GitHub
commit bb5eb64b28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,6 +42,15 @@ class PackLibCommand extends BuildCommand
$builder->proveLibs($libraries);
$builder->validateLibsAndExts();
// before pack, check if the dependency tree contains lib-suggests
foreach ($libraries as $lib) {
if (Config::getLib($lib, 'lib-suggests', []) !== []) {
logger()->critical("The library {$lib} has lib-suggests, packing [{$lib_name}] is not safe, abort !");
return static::FAILURE;
}
}
foreach ($builder->getLibs() as $lib) {
if ($lib->getName() !== $lib_name) {
// other dependencies: install or build, both ok