mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
Refactor app download logic for code reuse between UI and CLI
Moves the `Start-WingetAppDownloadTask` function from the UI module to the common module to enable parallel app downloads in both CLI and UI build paths. This eliminates code duplication and ensures consistent download behavior across build modes. Updates the `Get-Apps` function to leverage parallel processing instead of sequential iteration, improving performance when downloading multiple applications. Adds support for `LogFilePath` and `ThrottleLimit` parameters to control logging and concurrency. Introduces a `SkipWin32Json` parameter to differentiate behavior between UI mode (skips JSON generation) and CLI mode (creates JSON for installation). This allows the same download task to work correctly in both contexts. Updates all callers of `Get-Apps` to pass the new parameters, ensuring proper logging and parallel execution configuration across the build pipeline.
This commit is contained in:
@@ -5262,7 +5262,7 @@ if ($InstallApps) {
|
||||
# If there are no existing apps, use the original AppList.json directly
|
||||
if (-not $hasExistingApps) {
|
||||
WriteLog "No existing applications found. Using original AppList.json for all apps."
|
||||
Get-Apps -AppList $AppListPath -AppsPath $AppsPath -WindowsArch $WindowsArch -OrchestrationPath $OrchestrationPath
|
||||
Get-Apps -AppList $AppListPath -AppsPath $AppsPath -WindowsArch $WindowsArch -OrchestrationPath $OrchestrationPath -LogFilePath $LogFile -ThrottleLimit $Threads
|
||||
}
|
||||
else {
|
||||
# Compare apps in AppList.json with existing installations
|
||||
@@ -5334,7 +5334,7 @@ if ($InstallApps) {
|
||||
|
||||
# Download missing apps
|
||||
WriteLog "Downloading missing applications"
|
||||
Get-Apps -AppList $modifiedAppListPath -AppsPath $AppsPath -WindowsArch $WindowsArch -OrchestrationPath $OrchestrationPath
|
||||
Get-Apps -AppList $modifiedAppListPath -AppsPath $AppsPath -WindowsArch $WindowsArch -OrchestrationPath $OrchestrationPath -LogFilePath $LogFile -ThrottleLimit $Threads
|
||||
|
||||
# Cleanup modified app list
|
||||
Remove-Item -Path $modifiedAppListPath -Force
|
||||
|
||||
Reference in New Issue
Block a user