mirror of
https://github.com/icsharpcode/ILSpy.git
synced 2026-10-12 02:15:58 +00:00
With the move to Avalonia the app runs on Linux and macOS, so the distribution tooling grows beyond Windows: publish.ps1 gains a -Platform parameter (the default keeps the Windows behavior unchanged), and new BuildTools scripts package the self-contained publish outputs into a zip, deb, and rpm on Linux and a zipped ILSpy.app on macOS. Nothing is signed at package time; signing happens offline on the release manager machine. Info-ZIP zip is used instead of Compress-Archive because the latter drops unix mode bits. deb/rpm are built with dpkg-deb/rpmbuild directly (both preinstalled on GitHub ubuntu runners) following sourcegit-scm/sourcegit's proven model, including the libicu OR-chain in the deb control file and disabled auto-requires for the self-contained rpm payload. Pre-release versions map '-' to '~' so both package managers sort them before the release. The macOS bundle's Info.plist now carries placeholders stamped at package time; on Windows the spec/control/desktop files are kept LF via .gitattributes because Linux tools consume them verbatim. Assisted-by: Claude:claude-fable-5:Claude Code
64 lines
2.4 KiB
PowerShell
64 lines
2.4 KiB
PowerShell
#!/usr/bin/env pwsh
|
|
# Package the osx-arm64 ILSpy.app bundle (created by `./publish.ps1 -Platform macos` via the
|
|
# BuildMacAppBundle target in ILSpy.csproj) into ILSpy_macos-arm64_<version>.zip.
|
|
# Stamps the version placeholders in the bundle's Info.plist first.
|
|
# Must run on macOS/Linux: Info-ZIP's zip preserves the execute flag and (-y) symlinks,
|
|
# which Compress-Archive does not.
|
|
param(
|
|
[ValidateSet('Debug', 'Release')]
|
|
[string]$Configuration = 'Release',
|
|
# Defaults to the CI-computed version (env var, then the ILSPY_VERSION file written by
|
|
# BuildTools/ghactions-install.ps1), falling back to the committed VERSION file for
|
|
# local runs.
|
|
[string]$Version,
|
|
[string]$StagingDirectory = 'buildartifacts'
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
$PSNativeCommandUseErrorActionPreference = $true
|
|
|
|
$repoRoot = Split-Path -Parent $PSScriptRoot
|
|
|
|
if (-not (Get-Command zip -ErrorAction SilentlyContinue)) {
|
|
throw "'zip' not found. This script needs Info-ZIP, available on macOS and Linux."
|
|
}
|
|
|
|
if (-not $Version) {
|
|
if ($env:ILSPY_VERSION_NUMBER) {
|
|
$Version = $env:ILSPY_VERSION_NUMBER
|
|
}
|
|
elseif (Test-Path (Join-Path $repoRoot 'ILSPY_VERSION')) {
|
|
$Version = (Get-Content (Join-Path $repoRoot 'ILSPY_VERSION') -Raw).Trim()
|
|
}
|
|
else {
|
|
$Version = (Get-Content (Join-Path $repoRoot 'VERSION') -Raw).Trim()
|
|
}
|
|
}
|
|
|
|
$publishDir = Join-Path $repoRoot "ILSpy/bin/$Configuration/net10.0/osx-arm64/publish"
|
|
$appDir = Join-Path $publishDir 'ILSpy.app'
|
|
if (-not (Test-Path $appDir)) {
|
|
throw "ILSpy.app not found at $appDir. Run ./publish.ps1 -Configuration $Configuration -Platform macos first."
|
|
}
|
|
|
|
# CFBundleVersion / CFBundleShortVersionString must be dotted numerics; strip the
|
|
# pre-release suffix (11.0.0.8948-preview1 -> 11.0.0.8948) and shorten to three parts.
|
|
$numericVersion = ($Version -split '-')[0]
|
|
$shortVersion = ($numericVersion -split '\.')[0..2] -join '.'
|
|
$plistPath = Join-Path $appDir 'Contents/Info.plist'
|
|
$plist = (Get-Content $plistPath -Raw).
|
|
Replace('ILSPY_SHORT_VERSION', $shortVersion).
|
|
Replace('ILSPY_VERSION', $numericVersion)
|
|
Set-Content $plistPath $plist
|
|
|
|
$staging = New-Item -ItemType Directory -Force (Join-Path $repoRoot $StagingDirectory)
|
|
$zipPath = Join-Path $staging "ILSpy_macos-arm64_$Version.zip"
|
|
Remove-Item $zipPath -ErrorAction Ignore
|
|
Push-Location $publishDir
|
|
try {
|
|
zip -r -y -q $zipPath ILSpy.app -x '*.pdb'
|
|
}
|
|
finally {
|
|
Pop-Location
|
|
}
|
|
Write-Host "created $zipPath"
|