forked from OpenTabletDriver/OpenTabletDriver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
54 lines (42 loc) · 1.88 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
46
47
48
49
50
51
52
53
54
# Simple powershell script to easily build on Windows and verify functionality.
$ErrorActionPreference = "Stop";
$NetRuntime = "win-x64";
$PrevPath = $(Get-Location).Path;
$nl = [Environment]::NewLine;
$Config = "Release";
$Options = @("--configuration", "$Config", "--verbosity=quiet", "--self-contained=false", "--output=./bin", "/p:PublishSingleFile=true", "/p:DebugType=embedded",`
"/p:SuppressNETCoreSdkPreviewMessage=true", "/p:PublishTrimmed=false", "--runtime=$NetRuntime", "-p:SourceRevisionId=$(git rev-parse --short HEAD)");
# Change dir to script root, in case people run the script outside of the folder.
Set-Location $PSScriptRoot;
# Sanity check
if (!(Test-Path "./OpenTabletDriver")) {
Write-Error "Could not find OpenTabletDriver folder! Please put this script from the root of the OpenTabletDriver repository.";
exit 1;
}
Write-Output "Cleaning old build dirs...";
if (Test-Path "./bin") {
try {
Get-ChildItem -Path "./bin" | ForEach-Object {
if ($_.Name -ne "userdata") {
Remove-Item -Path $_.FullName -Recurse -Force;
}
}
} catch {
Write-Error "Could not clean old build dirs. Please manually remove contents of ./bin folder.";
exit 1;
}
}
dotnet clean --configuration $Config --verbosity=quiet;
Write-Output "Building OpenTabletDriver with runtime $NetRuntime...";
New-Item -ItemType Directory -Force -Path "./bin";
Write-Output "${nl}Building Daemon...$nl";
dotnet publish .\OpenTabletDriver.Daemon $Options;
if ($LASTEXITCODE -ne 0) { exit 1; }
Write-Output "${nl}Building Console...$nl";
dotnet publish .\OpenTabletDriver.Console $Options;
if ($LASTEXITCODE -ne 0) { exit 2; }
Write-Output "${nl}Building WPF UX...$nl";
dotnet publish .\OpenTabletDriver.UX.Wpf $Options;
if ($LASTEXITCODE -ne 0) { exit 3; }
Write-Output "${nl}Build finished. Binaries created in ./bin";
Set-Location $PrevPath;