Code style fix and comment addition

This commit is contained in:
crazywhalecc 2024-07-07 21:18:30 +08:00 committed by Jerry Ma
parent 3c0eb68c70
commit c6a22fbd14
4 changed files with 3 additions and 4 deletions

View File

@ -45,7 +45,7 @@ abstract class LibraryBase
$lock = json_decode(FileSystem::readFile(DOWNLOAD_PATH . '/.lock.json'), true) ?? [];
$source = Config::getLib(static::NAME, 'source');
// if source is locked as pre-built, we just tryInstall it
if (isset($lock[$source]) && $lock[$source]['lock_as'] === SPC_LOCK_PRE_BUILT) {
if (isset($lock[$source]) && ($lock[$source]['lock_as'] ?? SPC_LOCK_SOURCE) === SPC_LOCK_PRE_BUILT) {
return $this->tryInstall($lock[$source]['filename'], $force);
}
return $this->tryBuild($force);

View File

@ -147,7 +147,7 @@ class BuildCliCommand extends BuildCommand
$builder->proveExts($extensions);
// validate libs and exts
$builder->validateLibsAndExts();
// build libraries
// build or install libraries
$builder->setupLibs();
if ($this->input->getOption('with-clean')) {

View File

@ -64,7 +64,7 @@ class PackLibCommand extends BuildCommand
FileSystem::writeFile(WORKING_DIR . '/packlib_files.txt', implode("\n", $increase_files));
// pack
$filename = WORKING_DIR . '/dist/' . $lib->getName() . '-' . arch2gnu(php_uname('m')) . '-' . strtolower(PHP_OS_FAMILY) . '.' . Config::getPreBuilt('suffix');
f_passthru('tar -czf ' . $filename . ' -T ' . WORKING_DIR . '/packlib_files.txt -C ' . WORKING_DIR);
f_passthru('tar -czf ' . $filename . ' -T ' . WORKING_DIR . '/packlib_files.txt');
logger()->info('Pack library ' . $lib->getName() . ' to ' . $filename . ' complete.');
}
}

View File

@ -558,7 +558,6 @@ class Downloader
try {
f_passthru($cmd);
} catch (RuntimeException $e) {
var_dump($e->getCode());
if ($e->getCode() === 2 || $e->getCode() === -1073741510) {
throw new WrongUsageException('Keyboard interrupted, download failed !');
}