diff --git a/tools/publish-bin.ps1 b/tools/publish-bin.ps1 index 6348826e..d1df1889 100644 --- a/tools/publish-bin.ps1 +++ b/tools/publish-bin.ps1 @@ -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