-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.ps1
More file actions
36 lines (29 loc) · 1.24 KB
/
Copy pathbuild.ps1
File metadata and controls
36 lines (29 loc) · 1.24 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
$ErrorActionPreference = "Stop"
$project = "SCAScanner.csproj"
$publishConfig = @(
"--self-contained", "true",
"-p:PublishSingleFile=true",
"-p:PublishTrimmed=false",
"-c", "Release"
)
$targets = @(
@{ Rid = "osx-arm64"; Output = "publish/osx-arm64"; Source = "SCAScanner"; Artifact = "SCAScanner-osx-arm64" },
@{ Rid = "linux-x64"; Output = "publish/linux-x64"; Source = "SCAScanner"; Artifact = "SCAScanner-linux-x64" },
@{ Rid = "win-x64"; Output = "publish/win-x64"; Source = "SCAScanner.exe"; Artifact = "SCAScanner-win-x64.exe" }
)
Write-Host "Building SCAScanner - self-contained single-file executables"
Write-Host ""
foreach ($target in $targets) {
dotnet publish $project -r $target.Rid @publishConfig -o $target.Output
Write-Host ""
}
$releaseDir = "publish/release"
New-Item -ItemType Directory -Path $releaseDir -Force | Out-Null
foreach ($target in $targets) {
$src = Join-Path $target.Output $target.Source
$dest = Join-Path $releaseDir $target.Artifact
Copy-Item -LiteralPath $src -Destination $dest -Force
}
Write-Host "Build complete:"
Get-ChildItem -LiteralPath $releaseDir -File |
Select-Object Name, @{ Name = "SizeMB"; Expression = { "{0:N2}" -f ($_.Length / 1MB) } }