mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 16:55:38 +08:00
Allow locking different arch pre-built content
This commit is contained in:
@@ -8,6 +8,7 @@ use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\Config;
|
||||
use SPC\store\Downloader;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\store\SourceManager;
|
||||
|
||||
@@ -45,8 +46,9 @@ 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_SOURCE) === SPC_LOCK_PRE_BUILT) {
|
||||
return $this->tryInstall($lock[$source]['filename'], $force);
|
||||
$pre_built_name = Downloader::getPreBuiltName($source);
|
||||
if (isset($lock[$pre_built_name]) && ($lock[$pre_built_name]['lock_as'] ?? SPC_DOWN_SOURCE) === SPC_DOWN_PRE_BUILT) {
|
||||
return $this->tryInstall($lock[$pre_built_name]['filename'], $force);
|
||||
}
|
||||
return $this->tryBuild($force);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user