-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathpublish-mac.ps1
37 lines (28 loc) · 1.3 KB
/
publish-mac.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/pwsh
Clear-Host
if ($PSVersionTable.PSVersion.Major -lt 6)
{
Write-Host 'Restarting using pwsh...'
pwsh $PSCommandPath
return
}
Write-Host 'Clearing bin/obj...' -ForegroundColor Cyan
Remove-Item -LiteralPath UI.Avalonia/bin -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -LiteralPath UI.Avalonia/obj -Recurse -Force -ErrorAction SilentlyContinue
Write-Host 'Building macOS binary...' -ForegroundColor Cyan
dotnet publish -v:q -t:BundleApp -r osx-arm64 -f net9.0 --self-contained -c MacOS -o distrib/gui/mac/ UI.Avalonia/UI.Avalonia.csproj /p:PublishTrimmed=False /p:PublishSingleFile=True
Write-Host 'Clearing extra files in distrib...' -ForegroundColor Cyan
Get-ChildItem -LiteralPath distrib -Include *.pdb,*.config -Recurse | Remove-Item
if (($LASTEXITCODE -eq 0) -and ($IsMacOS -or ($PSVersionTable.Platform -eq 'Unix')))
{
chmod +x distrib/gui/mac/ps3-disc-dumper
# The final app bundle needs to be re-signed as a whole.
codesign --deep -fs - 'distrib/gui/mac/PS3 Disc Dumper.app'
}
Write-Host 'Bundling...' -ForegroundColor Cyan
if (Test-Path -LiteralPath 'distrib/gui/mac/PS3 Disc Dumper.app')
{
# tar to preserve file permissions.
tar -C distrib/gui/mac -cvzf distrib/ps3-disc-dumper_macos_NEW.tar.gz 'PS3 Disc Dumper.app'
}
Write-Host 'Done' -ForegroundColor Cyan