fix(launcher-feed): strip debug symbols from distribution payloads (103 MB -> 77 MB)

A stock publish shipped native debug symbols to players: libSkiaSharp.pdb
(80 MB) and libHarfBuzzSharp.pdb (20 MB) from Avalonia's rendering packages
were 100 MB of a 278 MB launcher payload. MSBuild's DebugType switches only
govern our own managed symbols, not native .pdb files arriving as package
runtime assets, so the payload build drops every .pdb before zipping.

launcher-win-x64.zip 103.4 -> 77.4 MB, client 44.5 -> 43.6 MB. The launcher
payload now also fits under GitHub's 100 MB per-file limit, though the feed
stays on the Gitea-only dist branch to keep main's history clean.

Also fixes a StrictMode crash in the lock-file warning: an empty git status
result is null, not an empty array, so .Count threw at the end of a
successful publish.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-18 19:56:20 +02:00
parent 600c331ac6
commit f260260caf

View file

@ -109,6 +109,23 @@ function Invoke-Publish {
if ($LASTEXITCODE) { throw "publish failed: $Project ($Rid)" }
}
function Remove-DebugSymbols {
param([Parameter(Mandatory)][string]$Directory)
# Players never load these, and the native ones are enormous: a stock
# Avalonia publish ships libSkiaSharp.pdb (80 MB) and
# libHarfBuzzSharp.pdb (20 MB), which alone were 100 MB of a 278 MB
# launcher payload (measured 2026-08-18). MSBuild's DebugType switches
# only govern OUR managed symbols, not the native .pdb files that arrive
# as package runtime assets, so drop them from the payload directly.
$symbols = @(Get-ChildItem -LiteralPath $Directory -Recurse -File -Filter *.pdb)
if ($symbols.Count -eq 0) { return }
$freed = ($symbols | Measure-Object -Property Length -Sum).Sum
$symbols | Remove-Item -Force
' stripped {0} debug symbol file(s), {1:N1} MB' -f $symbols.Count, ($freed / 1MB) |
Write-Host -ForegroundColor DarkGray
}
function New-PayloadZip {
param(
[Parameter(Mandatory)][string]$SourceDirectory,
@ -116,6 +133,8 @@ function New-PayloadZip {
[Parameter(Mandatory)][string[]]$RequiredFiles
)
Remove-DebugSymbols $SourceDirectory
foreach ($required in $RequiredFiles) {
if (-not (Test-Path -LiteralPath (Join-Path $SourceDirectory $required))) {
throw "Payload '$SourceDirectory' is missing required file '$required'."
@ -208,8 +227,9 @@ foreach ($file in (Get-ChildItem -LiteralPath $BinRoot -File | Sort-Object Name)
# about the source changed. Report it rather than silently reverting: the files
# are the developer's, and a real dependency change must not be swallowed here.
$dirtyLocks = @(
& git -C $RepoRoot status --porcelain -- '*packages.*.lock.json' 2>$null
) | Where-Object { $_ }
@(& git -C $RepoRoot status --porcelain -- '*packages.*.lock.json' 2>$null) |
Where-Object { $_ }
)
if ($dirtyLocks.Count -gt 0) {
Write-Host ''
Write-Host 'Note: the RID restore modified these lock files:' -ForegroundColor Yellow