-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate PSWindowsUpdate GUI to WinUI 3 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,16 @@ | ||
| PSWindowsUpdateGUI 2.x does not bundle PSWindowsUpdate or another update engine. | ||
| PSWindowsUpdateGUI does not redistribute a third-party update engine. | ||
|
|
||
| The self-contained executable redistributes the Microsoft .NET 10 runtime, Windows | ||
| App SDK 2.3.1 runtime files, and System.ServiceProcess.ServiceController 10.0. These | ||
| Microsoft open-source components are distributed under the MIT License. Their exact | ||
| package versions and relationships are recorded in the accompanying SPDX SBOM. | ||
|
|
||
| The application uses Windows Update Agent (wuapi.dll), Windows PowerShell 5.1 for | ||
| authenticated WinRM transport, and other Windows components already present on the | ||
| supported operating system. Those operating-system components are not redistributed. | ||
|
|
||
| Repository history prior to 2.0 contains an embedded copy of PSWindowsUpdate 2.2.1.5, | ||
| copyright Michal Gajda and licensed under the MIT License. No PSWindowsUpdate files are | ||
| present in 2.x source or release assets. | ||
| Project and license information: | ||
|
|
||
| - https://github.com/dotnet/runtime | ||
| - https://github.com/microsoft/WindowsAppSDK | ||
| - https://licenses.nuget.org/MIT |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,29 +5,41 @@ param( | |
|
|
||
| $ErrorActionPreference = 'Stop' | ||
| $repoRoot = Split-Path -Parent $PSScriptRoot | ||
| $executable = Join-Path $repoRoot "tests\PSWindowsUpdateGui.UiSmoke\bin\x64\$Configuration\net48\PSWindowsUpdateGui.UiSmoke.exe" | ||
| $dotnet = if ($env:DOTNET_EXE) { $env:DOTNET_EXE } else { 'dotnet' } | ||
| $project = Join-Path $repoRoot 'src\PSWindowsUpdateGui\PSWindowsUpdateGui.csproj' | ||
| $smokeRoot = Join-Path $repoRoot 'artifacts\ui-smoke-build' | ||
| $darkCapture = Join-Path $repoRoot 'artifacts\ui-smoke-history-dark.png' | ||
| $lightCapture = Join-Path $repoRoot 'artifacts\ui-smoke-updates-light.png' | ||
| $executable = Join-Path $smokeRoot 'PSWindowsUpdateGUI.exe' | ||
| $errorLog = Join-Path (Split-Path -Parent $executable) 'ui-smoke-error.log' | ||
| if (-not (Test-Path -LiteralPath $executable)) { throw "GUI smoke harness was not built: $executable" } | ||
| if (Test-Path -LiteralPath $errorLog) { Remove-Item -LiteralPath $errorLog -Force } | ||
| & $dotnet build $project -c UiSmoke '-p:Platform=x64' '-p:UiSmokeBuild=true' "-p:OutputPath=$smokeRoot\" --no-restore | ||
| if ($LASTEXITCODE -ne 0) { throw "WinUI smoke build failed with exit code $LASTEXITCODE." } | ||
| if (-not (Test-Path -LiteralPath $executable)) { throw "WinUI smoke executable was not built: $executable" } | ||
|
|
||
| $process = Start-Process -FilePath $executable -PassThru -WindowStyle Hidden | ||
| foreach ($file in @($errorLog, $darkCapture, $lightCapture)) { | ||
| if (Test-Path -LiteralPath $file) { Remove-Item -LiteralPath $file -Force } | ||
| } | ||
|
|
||
| $previousDotnetRootX64 = $env:DOTNET_ROOT_X64 | ||
| try { | ||
| $deadline = [DateTime]::UtcNow.AddSeconds(20) | ||
| do { | ||
| Start-Sleep -Milliseconds 200 | ||
| $process.Refresh() | ||
| if ($process.HasExited) { | ||
| if ($dotnet -ne 'dotnet') { $env:DOTNET_ROOT_X64 = [System.IO.Path]::GetFullPath((Split-Path -Parent $dotnet)) } | ||
| $scenarios = @( | ||
| @{ Theme = 'Dark'; Page = 'history'; Capture = $darkCapture }, | ||
| @{ Theme = 'Light'; Page = 'updates'; Capture = $lightCapture } | ||
| ) | ||
| foreach ($scenario in $scenarios) { | ||
| $process = Start-Process -FilePath $executable -ArgumentList @('--ui-smoke', '--theme', $scenario.Theme, '--page', $scenario.Page, '--capture', "`"$($scenario.Capture)`"") -PassThru -Wait | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If WinUI initialization, activation, or screenshot capture deadlocks, Useful? React with 👍 / 👎. |
||
| if ($process.ExitCode -ne 0) { | ||
| $detail = if (Test-Path -LiteralPath $errorLog) { Get-Content -LiteralPath $errorLog -Raw } else { "Exit code $($process.ExitCode)." } | ||
| throw "GUI smoke harness exited before creating a window. $detail" | ||
| throw "WinUI $($scenario.Theme) $($scenario.Page) smoke test failed. $detail" | ||
| } | ||
| } while ($process.MainWindowHandle -eq [IntPtr]::Zero -and [DateTime]::UtcNow -lt $deadline) | ||
|
|
||
| if ($process.MainWindowHandle -eq [IntPtr]::Zero) { throw 'GUI smoke harness did not create a WPF window within 20 seconds.' } | ||
| Write-Host "GUI smoke window created successfully (PID $($process.Id))." | ||
| } | ||
| } | ||
| finally { | ||
| if (-not $process.HasExited) { | ||
| [void] $process.CloseMainWindow() | ||
| if (-not $process.WaitForExit(5000)) { Stop-Process -Id $process.Id -Force } | ||
| } | ||
| $env:DOTNET_ROOT_X64 = $previousDotnetRootX64 | ||
| } | ||
|
|
||
| foreach ($capture in @($darkCapture, $lightCapture)) { | ||
| if (-not (Test-Path -LiteralPath $capture) -or (Get-Item -LiteralPath $capture).Length -lt 1024) { throw "WinUI smoke test did not create a valid screenshot: $capture" } | ||
| } | ||
| Write-Host "WinUI production-assembly smoke tests passed: $darkCapture, $lightCapture" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script will fail before running either smoke scenario: passing
-p:OutputPath=$smokeRoot\to an SDK-style build does not suppress the default target-framework and runtime-identifier suffixes, and this project sets bothnet10.0-windows10.0.26100.0andwin-x64. The executable is therefore emitted below$smokeRoot\net10.0-windows10.0.26100.0\win-x64\, while the next check looks only for$smokeRoot\PSWindowsUpdateGUI.exe; every normalBuild.ps1run with tests enabled reaches that failing check.Useful? React with 👍 / 👎.