Add extract source only mode for SourceManager

This commit is contained in:
crazywhalecc
2025-03-31 16:37:24 +08:00
parent 610843398e
commit 4e4eaed123
4 changed files with 7 additions and 6 deletions

View File

@@ -15,7 +15,7 @@ class SourceManager
* @throws FileSystemException
* @throws RuntimeException
*/
public static function initSource(?array $sources = null, ?array $libs = null, ?array $exts = null): void
public static function initSource(?array $sources = null, ?array $libs = null, ?array $exts = null, bool $source_only = false): void
{
if (!file_exists(DOWNLOAD_PATH . '/.lock.json')) {
throw new WrongUsageException('Download lock file "downloads/.lock.json" not found, maybe you need to download sources first ?');
@@ -56,7 +56,7 @@ class SourceManager
}
// check source downloaded
$pre_built_name = Downloader::getPreBuiltLockName($source);
if (!isset($lock[$pre_built_name])) {
if ($source_only || !isset($lock[$pre_built_name])) {
if (!isset($lock[$source])) {
throw new WrongUsageException("Source [{$source}] not downloaded or not locked, you should download it first !");
}