Deploy: trim unused native SkiaSharp variants from the package

SkiaSharp drags in win-x64/x86/arm64 native libs plus a macOS .dylib
regardless of RID. The net48 loader finds the native in either the app
root or an arch subfolder (both verified), so keep only the win-x64
libSkiaSharp.dll at the app root and drop the x64/x86/arm64 subdirs and
the .dylib. Package drops from ~25 MB to ~8 MB.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-06-30 14:27:10 -05:00
co-authored by Claude Opus 4.8
parent 270abfc5ad
commit 0a4b3e3c25
+15
View File
@@ -56,6 +56,21 @@ try {
-o $appOut | Out-Null -o $appOut | Out-Null
if ($LASTEXITCODE -ne 0) { throw 'dotnet publish failed.' } if ($LASTEXITCODE -ne 0) { throw 'dotnet publish failed.' }
# 1b. Trim native SkiaSharp variants the x64 pod never uses. SkiaSharp's net48
# loader finds the native in either the app root or an arch subfolder (both
# verified), so we keep only the win-x64 libSkiaSharp.dll at the app root and
# drop the x64/x86/arm64 subdir copies and the macOS .dylib (~38 MB).
$rootSkia = Join-Path $appOut 'libSkiaSharp.dll'
if (-not (Test-Path $rootSkia)) {
throw "Expected app\libSkiaSharp.dll (win-x64) before pruning, but it is missing."
}
foreach ($d in 'x64', 'x86', 'arm64') {
$nd = Join-Path $appOut $d
if (Test-Path $nd) { Remove-Item $nd -Recurse -Force }
}
Get-ChildItem $appOut -Filter '*.dylib' -ErrorAction SilentlyContinue | Remove-Item -Force
Get-ChildItem $appOut -Filter '*.so' -ErrorAction SilentlyContinue | Remove-Item -Force
# 2. Bundle the signed ViGEmBus installer into riojoy\vendor. # 2. Bundle the signed ViGEmBus installer into riojoy\vendor.
$vendorOut = Join-Path $pkgDir 'vendor' $vendorOut = Join-Path $pkgDir 'vendor'
New-Item -ItemType Directory -Force -Path $vendorOut | Out-Null New-Item -ItemType Directory -Force -Path $vendorOut | Out-Null