mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 21:04:52 +08:00
suggestions
This commit is contained in:
parent
b88a68dab8
commit
ff15973a25
@ -45,7 +45,7 @@ trait postgresql
|
|||||||
|
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
$libs = array_map(fn ($x) => $x->getName(), $this->getDependencies());
|
$libs = array_map(fn ($x) => $x->getName(), $this->getDependencies(true));
|
||||||
$spc = new SPCConfigUtil($this->builder, ['no_php' => true, 'libs_only_deps' => true]);
|
$spc = new SPCConfigUtil($this->builder, ['no_php' => true, 'libs_only_deps' => true]);
|
||||||
$config = $spc->config(libraries: $libs, include_suggest_lib: $this->builder->getOption('with-suggested-libs'));
|
$config = $spc->config(libraries: $libs, include_suggest_lib: $this->builder->getOption('with-suggested-libs'));
|
||||||
|
|
||||||
|
|||||||
@ -105,7 +105,7 @@ class DependencyUtil
|
|||||||
* @param array $additional_libs Array of additional libraries
|
* @param array $additional_libs Array of additional libraries
|
||||||
* @return array Ordered array of extension names
|
* @return array Ordered array of extension names
|
||||||
*/
|
*/
|
||||||
public static function getExtsAndLibs(array $exts, array $additional_libs = [], bool $include_suggested_exts = false, bool $include_suggested_libs = false, array $extra_libraries_from_builder = []): array
|
public static function getExtsAndLibs(array $exts, array $additional_libs = [], bool $include_suggested_exts = false, bool $include_suggested_libs = false): array
|
||||||
{
|
{
|
||||||
$dep_list = self::platExtToLibs();
|
$dep_list = self::platExtToLibs();
|
||||||
|
|
||||||
@ -144,23 +144,6 @@ class DependencyUtil
|
|||||||
$dep_list[$name]['suggests'] = array_values($dep_list[$name]['suggests']);
|
$dep_list[$name]['suggests'] = array_values($dep_list[$name]['suggests']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// include suggested libraries
|
|
||||||
if ($extra_libraries_from_builder) {
|
|
||||||
// check every deps suggests
|
|
||||||
foreach ($dep_list as $name => $obj) {
|
|
||||||
$del_list = [];
|
|
||||||
foreach ($obj['suggests'] as $id => $suggest) {
|
|
||||||
if (!str_starts_with($suggest, 'ext@') && in_array($suggest, $extra_libraries_from_builder)) {
|
|
||||||
$dep_list[$name]['depends'][] = $suggest;
|
|
||||||
$del_list[] = $id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach ($del_list as $id) {
|
|
||||||
unset($dep_list[$name]['suggests'][$id]);
|
|
||||||
}
|
|
||||||
$dep_list[$name]['suggests'] = array_values($dep_list[$name]['suggests']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// convert ext_name to ext@ext_name
|
// convert ext_name to ext@ext_name
|
||||||
$origin_exts = $exts;
|
$origin_exts = $exts;
|
||||||
|
|||||||
@ -62,8 +62,7 @@ class SPCConfigUtil
|
|||||||
$extensions[] = $ext;
|
$extensions[] = $ext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$extra_builder_libs = $this->builder?->getLibs() ?? [];
|
[$extensions, $libraries] = DependencyUtil::getExtsAndLibs($extensions, $libraries, $include_suggest_ext, $include_suggest_lib);
|
||||||
[$extensions, $libraries] = DependencyUtil::getExtsAndLibs($extensions, $libraries, $include_suggest_ext, $include_suggest_lib, array_map(fn ($l) => $l->getName(), $extra_builder_libs));
|
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
if ($this->builder === null) {
|
if ($this->builder === null) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user