-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.ps1
45 lines (34 loc) · 1.19 KB
/
build.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
36
37
38
39
40
41
42
43
44
45
param (
[switch]$SkipTests,
[switch]$SkipPack,
[ValidateSet("Debug", "Release")]
[string]$Configuration = "Release"
)
$RepoName = "NupkgWrench"
$RepoRoot = $PSScriptRoot
pushd $RepoRoot
# Load common build script helper methods
. "$PSScriptRoot\build\common\common.ps1"
# Download tools
Install-CommonBuildTools $RepoRoot
# Clean and write git info
Remove-Artifacts $RepoRoot
Invoke-DotnetMSBuild $RepoRoot ("build\build.proj", "/t:Clean;WriteGitInfo", "/p:Configuration=$Configuration")
# Build Exe
Invoke-DotnetExe $RepoRoot ("publish", "--force", "-r", "win-x64", "-p:PublishSingleFile=true", "-p:PublishTrimmed=false", "--self-contained", "true", "-f", "net8.0", "-o", (Join-Path $RepoRoot "artifacts\publish"), (Join-Path $RepoRoot "\src\NupkgWrench\NupkgWrench.csproj"))
# Restore
Invoke-DotnetMSBuild $RepoRoot ("build\build.proj", "/t:Restore", "/p:Configuration=$Configuration")
# Run main build
$buildTargets = "Build"
if (-not $SkipTests)
{
$buildTargets += ";Test"
}
if (-not $SkipPack)
{
$buildTargets += ";Pack"
}
# Run build.proj
Invoke-DotnetMSBuild $RepoRoot ("build\build.proj", "/t:$buildTargets", "/p:Configuration=$Configuration")
popd
Write-Host "Success!"