-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.ps1
More file actions
126 lines (106 loc) · 5.03 KB
/
build.ps1
File metadata and controls
126 lines (106 loc) · 5.03 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
$Version = Get-Date -Format "yyyy-MM-dd"
$Project = "MagickCrop"
# Define build paths for both architectures
$BuildPathX64 = "$PSScriptRoot\bld\x64"
$BuildPathX64SC = "$PSScriptRoot\bld\x64\MagickCrop-Self-Contained"
$BuildPathARM64 = "$PSScriptRoot\bld\arm64"
$BuildPathARM64SC = "$PSScriptRoot\bld\arm64\MagickCrop-arm64-Self-Contained"
# Define archive paths
$ArchiveX64SC = "$BuildPathX64\$Project-x64-Self-Contained-$Version.zip"
$ArchiveARM64SC = "$BuildPathARM64\$Project-arm64-Self-Contained-$Version.zip"
Write-Host "Building MagickCrop for x64 and ARM64 architectures..." -ForegroundColor Green
Write-Host "Build Date: $Version" -ForegroundColor Yellow
# Clean up existing build directories
Write-Host "`nCleaning up existing build directories..." -ForegroundColor Cyan
if (Test-Path -Path $BuildPathX64) {
Remove-Item $BuildPathX64 -Recurse -Force
}
if (Test-Path -Path $BuildPathARM64) {
Remove-Item $BuildPathARM64 -Recurse -Force
}
# Create build directories
New-Item -ItemType Directory -Path $BuildPathX64 -Force | Out-Null
New-Item -ItemType Directory -Path $BuildPathARM64 -Force | Out-Null
Write-Host "`n=== Building x64 Versions ===" -ForegroundColor Magenta
# Build x64 Framework-Dependent
Write-Host "Building x64 framework-dependent..." -ForegroundColor Yellow
dotnet publish "$PSScriptRoot\$Project\$Project.csproj" `
--runtime win-x64 `
--self-contained false `
-c Release `
-v minimal `
-o $BuildPathX64 `
-p:EnableMsixTooling=true `
-p:PublishReadyToRun=false `
-p:PublishSingleFile=true `
-p:CopyOutputSymbolsToPublishDirectory=false `
--nologo
# Build x64 Self-Contained
Write-Host "Building x64 self-contained..." -ForegroundColor Yellow
dotnet publish "$PSScriptRoot\$Project\$Project.csproj" `
--runtime win-x64 `
--self-contained true `
-c Release `
-v minimal `
-o $BuildPathX64SC `
-p:EnableMsixTooling=true `
-p:PublishReadyToRun=true `
-p:PublishSingleFile=true `
-p:CopyOutputSymbolsToPublishDirectory=false `
--nologo
Write-Host "`n=== Building ARM64 Versions ===" -ForegroundColor Magenta
# Build ARM64 Framework-Dependent
Write-Host "Building ARM64 framework-dependent..." -ForegroundColor Yellow
dotnet publish "$PSScriptRoot\$Project\$Project.csproj" `
--runtime win-arm64 `
--self-contained false `
-c Release `
-v minimal `
-o $BuildPathARM64 `
-p:PublishSingleFile=true `
-p:EnableMsixTooling=true `
-p:CopyOutputSymbolsToPublishDirectory=false `
--nologo
# Build ARM64 Self-Contained
Write-Host "Building ARM64 self-contained..." -ForegroundColor Yellow
dotnet publish "$PSScriptRoot\$Project\$Project.csproj" `
--runtime win-arm64 `
--self-contained true `
-c Release `
-v minimal `
-o $BuildPathARM64SC `
-p:PublishSingleFile=true `
-p:EnableMsixTooling=true `
-p:CopyOutputSymbolsToPublishDirectory=false `
--nologo
Write-Host "`n=== Renaming ARM64 Executables ===" -ForegroundColor Magenta
# Rename ARM64 Framework-Dependent executable
Write-Host "Renaming ARM64 framework-dependent executable..." -ForegroundColor Yellow
if (Test-Path "$BuildPathARM64\$Project.exe") {
Rename-Item "$BuildPathARM64\$Project.exe" "MagickCrop-arm64.exe"
}
# Rename ARM64 Self-Contained executable
Write-Host "Renaming ARM64 self-contained executable..." -ForegroundColor Yellow
if (Test-Path "$BuildPathARM64SC\$Project.exe") {
Rename-Item "$BuildPathARM64SC\$Project.exe" "MagickCrop-arm64.exe"
}
Write-Host "`n=== Creating Archives ===" -ForegroundColor Magenta
# Create x64 Self-Contained Archive
Write-Host "Creating x64 self-contained archive..." -ForegroundColor Yellow
Compress-Archive -Path "$BuildPathX64SC" -DestinationPath $ArchiveX64SC -Force
# Create ARM64 Self-Contained Archive
Write-Host "Creating ARM64 self-contained archive..." -ForegroundColor Yellow
Compress-Archive -Path "$BuildPathARM64SC" -DestinationPath $ArchiveARM64SC -Force
Write-Host "`n=== Build Summary ===" -ForegroundColor Green
Write-Host "x64 Framework-Dependent: $BuildPathX64\$Project.exe" -ForegroundColor White
Write-Host "x64 Self-Contained: $BuildPathX64SC\$Project.exe" -ForegroundColor White
Write-Host "x64 Self-Contained Archive: $ArchiveX64SC" -ForegroundColor White
Write-Host "ARM64 Framework-Dependent: $BuildPathARM64\MagickCrop-arm64.exe" -ForegroundColor White
Write-Host "ARM64 Self-Contained: $BuildPathARM64SC\MagickCrop-arm64.exe" -ForegroundColor White
Write-Host "ARM64 Self-Contained Archive: $ArchiveARM64SC" -ForegroundColor White
# Get and display the actual product version from the built executable
Write-Host "`n=== Version Information ===" -ForegroundColor Cyan
$versionInfo = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("$BuildPathX64\$Project.exe")
Write-Host "Product Version: $($versionInfo.ProductVersion)" -ForegroundColor White
Write-Host "File Version: $($versionInfo.FileVersion)" -ForegroundColor White
Write-Host "`nBuild completed successfully!" -ForegroundColor Green