Verify Windows desktop packaged runtime

This commit is contained in:
Курнат Андрей
2026-06-12 22:49:28 +03:00
parent da19575477
commit 2607c7d08e
2 changed files with 61 additions and 0 deletions
+60
View File
@@ -63,6 +63,64 @@ function Copy-DirectoryIfPresent([string]$Source, [string]$Destination) {
Copy-Item -Path (Join-Path $Source "*") -Destination $Destination -Recurse -Force
}
function Assert-StageFile([string]$StageDirectory, [string]$RelativePath) {
$path = Join-Path $StageDirectory $RelativePath
if (-not (Test-Path -LiteralPath $path)) {
Fail "Packaged runtime file is missing: $path"
}
if ((Get-Item -LiteralPath $path).Length -le 0) {
Fail "Packaged runtime file is empty: $path"
}
}
function Assert-WindowsRuntimeStage([string]$StageDirectory) {
$criticalFiles = @(
"qsfera.exe",
"qt.conf",
"Qt6Core.dll",
"Qt6Gui.dll",
"Qt6Widgets.dll",
"Qt6Network.dll",
"Qt6Qml.dll",
"Qt6Quick.dll",
"Qt6QuickControls2.dll",
"qt6keychain.dll",
"kdsingleapplication-qt6.dll",
"libcrypto-3-x64.dll",
"libssl-3-x64.dll",
"plugins\platforms\qwindows.dll",
"plugins\tls\qschannelbackend.dll",
"plugins\QSfera_vfs_cfapi.dll",
"plugins\QSfera_vfs_off.dll",
"qml\eu\QSfera\gui\qmldir",
"qml\QtQuick\Controls\qmldir"
)
foreach ($file in $criticalFiles) {
Assert-StageFile -StageDirectory $StageDirectory -RelativePath $file
}
$qtConf = Get-Content -LiteralPath (Join-Path $StageDirectory "qt.conf") -Raw -Encoding ASCII
foreach ($entry in @("Plugins=plugins", "Qml2Imports=qml", "Translations=translations")) {
if (-not $qtConf.Contains($entry)) {
Fail "qt.conf does not contain required entry '$entry'."
}
}
Push-Location $StageDirectory
try {
$versionOutput = & (Join-Path $StageDirectory "qsfera.exe") --version 2>&1
if ($LASTEXITCODE -ne 0) {
Fail "Packaged qsfera.exe failed to start from the staging directory. Output: $($versionOutput | Out-String)"
}
} finally {
Pop-Location
}
Write-Output "OK: packaged Windows runtime contains required Qt/MSVC/OpenSSL files and qsfera.exe --version starts from the staging directory."
}
function ConvertTo-WixIdentifier([string]$Prefix, [string]$Value) {
$normalized = ($Value -replace '[^A-Za-z0-9_]', '_')
if ($normalized.Length -gt 60) {
@@ -312,6 +370,8 @@ Qml2Imports=qml
Translations=translations
"@ | Set-Content -LiteralPath (Join-Path $StageDirectory "qt.conf") -Encoding ASCII
Assert-WindowsRuntimeStage -StageDirectory $StageDirectory
Remove-PathWithRetry $zipPath
Compress-ArchiveWithRetry -SourcePath (Join-Path $StageDirectory "*") -DestinationPath $zipPath