feat(client): improve SDK packaging and registry config
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$SdkRoot,
|
||||
|
||||
[string]$ReleaseDir = (Get-Location).Path,
|
||||
|
||||
[switch]$OverwriteConfig,
|
||||
|
||||
[switch]$IncludeQtRuntime
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$sdk = (Resolve-Path $SdkRoot).Path
|
||||
$release = (Resolve-Path $ReleaseDir).Path
|
||||
|
||||
$binDir = Join-Path $sdk "bin"
|
||||
$configDir = Join-Path $sdk "config"
|
||||
$appConfig = Join-Path $configDir "app_config.json"
|
||||
$publicKey = Join-Path $configDir "manifest_public_key.pem"
|
||||
|
||||
foreach ($path in @($binDir, $appConfig, $publicKey)) {
|
||||
if (-not (Test-Path $path)) {
|
||||
throw "SDK file is missing: $path"
|
||||
}
|
||||
}
|
||||
|
||||
function Test-IsQtRuntimeItem {
|
||||
param([System.IO.FileSystemInfo]$Item)
|
||||
|
||||
if ($IncludeQtRuntime) {
|
||||
return $false
|
||||
}
|
||||
|
||||
if ($Item.PSIsContainer) {
|
||||
return $Item.Name -in @(
|
||||
"bearer",
|
||||
"iconengines",
|
||||
"imageformats",
|
||||
"platforms",
|
||||
"styles",
|
||||
"translations"
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
$Item.Name -match '^Qt5.*\.dll$' -or
|
||||
$Item.Name -in @(
|
||||
"libEGL.dll",
|
||||
"libGLESv2.dll",
|
||||
"opengl32sw.dll",
|
||||
"d3dcompiler_47.dll"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Get-ChildItem $binDir -Force | Where-Object {
|
||||
-not (Test-IsQtRuntimeItem $_)
|
||||
} | Copy-Item -Destination $release -Recurse -Force
|
||||
|
||||
$targetConfigDir = Join-Path $release "config"
|
||||
New-Item $targetConfigDir -ItemType Directory -Force | Out-Null
|
||||
|
||||
$targetAppConfig = Join-Path $targetConfigDir "app_config.json"
|
||||
if ((-not (Test-Path $targetAppConfig)) -or $OverwriteConfig) {
|
||||
Copy-Item $appConfig $targetAppConfig -Force
|
||||
} else {
|
||||
Write-Host "Keep existing config/app_config.json. Use -OverwriteConfig to replace it."
|
||||
}
|
||||
|
||||
Copy-Item $publicKey (Join-Path $targetConfigDir "manifest_public_key.pem") -Force
|
||||
|
||||
Write-Host "SDK files installed to: $release"
|
||||
Write-Host "Next: edit config/app_config.json, then start Launcher.exe."
|
||||
Reference in New Issue
Block a user