Rename to suggestions

This commit is contained in:
crazywhalecc 2025-07-23 15:33:26 +08:00
parent 45f257ef14
commit b0c0ecb59c
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
3 changed files with 12 additions and 12 deletions

View File

@ -317,26 +317,26 @@ abstract class LibraryBase
protected function install(): void protected function install(): void
{ {
// replace placeholders if BUILD_ROOT_PATH/.spc-extract-placeholder.json exists // replace placeholders if BUILD_ROOT_PATH/.spc-extract-placeholder.json exists
$placeholder_file = BUILD_ROOT_PATH . '/.spc-extract-placeholder.json'; $replace_item_file = BUILD_ROOT_PATH . '/.spc-extract-placeholder.json';
if (!file_exists($placeholder_file)) { if (!file_exists($replace_item_file)) {
return; return;
} }
$placeholders = json_decode(file_get_contents($placeholder_file), true); $replace_items = json_decode(file_get_contents($replace_item_file), true);
if (!is_array($placeholders)) { if (!is_array($replace_items)) {
throw new RuntimeException('Invalid placeholder file: ' . $placeholder_file); throw new RuntimeException('Invalid placeholder file: ' . $replace_item_file);
} }
$placeholder_mark = get_pack_placehoder(); $placeholders = get_pack_replace();
// replace placeholders in BUILD_ROOT_PATH // replace placeholders in BUILD_ROOT_PATH
foreach ($placeholders as $item) { foreach ($replace_items as $item) {
$filepath = BUILD_ROOT_PATH . "/{$item}"; $filepath = BUILD_ROOT_PATH . "/{$item}";
FileSystem::replaceFileStr( FileSystem::replaceFileStr(
$filepath, $filepath,
array_values($placeholder_mark), array_values($placeholders),
array_keys($placeholder_mark), array_keys($placeholders),
); );
} }
// remove placeholder file // remove placeholder file
unlink($placeholder_file); unlink($replace_item_file);
} }
/** /**

View File

@ -53,7 +53,7 @@ class PackLibCommand extends BuildCommand
$origin_files = []; $origin_files = [];
// get pack placehoder defines // get pack placehoder defines
$placehoder = get_pack_placehoder(); $placehoder = get_pack_replace();
foreach ($builder->getLibs() as $lib) { foreach ($builder->getLibs() as $lib) {
if ($lib->getName() !== $lib_name) { if ($lib->getName() !== $lib_name) {

View File

@ -233,7 +233,7 @@ function ac_with_args(string $arg_name, bool $use_value = false): array
return $use_value ? ["--with-{$arg_name}=yes", "--with-{$arg_name}=no"] : ["--with-{$arg_name}", "--without-{$arg_name}"]; return $use_value ? ["--with-{$arg_name}=yes", "--with-{$arg_name}=no"] : ["--with-{$arg_name}", "--without-{$arg_name}"];
} }
function get_pack_placehoder(): array function get_pack_replace(): array
{ {
return [ return [
BUILD_LIB_PATH => '@build_lib_path@', BUILD_LIB_PATH => '@build_lib_path@',