Skip to content

Commit 9982831

Browse files
committed
Change build script to opt-in to WRC
1 parent e3d356a commit 9982831

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

Build/build-functions.psm1

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if ($msbuild) {
1111

1212
function Remove-ArtifactsDir {
1313
write-host -foreground blue "Clean up...`n"
14-
rm $artifactsDir -Recurse -ErrorAction Ignore
14+
rm $artifactsDir -Recurse -Force -ErrorAction Stop
1515
write-host -foreground blue "Clean up...END`n"
1616
}
1717

@@ -23,10 +23,17 @@ function Update-GeneratedCode {
2323
& "$root\UnitsNet\Scripts\GenerateUnits.ps1"
2424
if ($lastexitcode -ne 0) { exit 1 }
2525

26+
if (-not $IncludeWindowsRuntimeComponent) {
27+
write-host -foreground yellow "Skipping WindowsRuntimeComponent code regen."
28+
} else {
29+
& "$root\UnitsNet.WindowsRuntimeComponent\Scripts\GenerateUnits.ps1"
30+
if ($lastexitcode -ne 0) { exit 1 }
31+
}
32+
2633
write-host -foreground blue "Generate code...END`n"
2734
}
2835

29-
function Start-Build([boolean] $skipUWP = $false) {
36+
function Start-Build([boolean] $IncludeWindowsRuntimeComponent = $false) {
3037
write-host -foreground blue "Start-Build...`n---"
3138

3239
$fileLoggerArg = "/logger:FileLogger,Microsoft.Build;logfile=$testReportDir\UnitsNet.msbuild.log"
@@ -38,9 +45,9 @@ function Start-Build([boolean] $skipUWP = $false) {
3845
dotnet build --configuration Release "$root\UnitsNet.sln" $fileLoggerArg $appVeyorLoggerArg
3946
if ($lastexitcode -ne 0) { exit 1 }
4047

41-
if ($skipUWP -eq $true)
48+
if (-not $IncludeWindowsRuntimeComponent)
4249
{
43-
write-host -foreground yellow "Skipping WindowsRuntimeComponent build by user-specified flag."
50+
write-host -foreground yellow "Skipping WindowsRuntimeComponent build."
4451
}
4552
else
4653
{
@@ -98,8 +105,12 @@ function Start-PackNugets {
98105
if ($lastexitcode -ne 0) { exit 1 }
99106
}
100107

101-
write-host -foreground yellow "WindowsRuntimeComponent project not yet supported by dotnet CLI, using nuget.exe instead"
102-
& $nuget pack "$root\UnitsNet.WindowsRuntimeComponent\UnitsNet.WindowsRuntimeComponent.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir"
108+
if (-not $IncludeWindowsRuntimeComponent) {
109+
write-host -foreground yellow "Skipping WindowsRuntimeComponent nuget pack."
110+
} else {
111+
write-host -foreground yellow "WindowsRuntimeComponent project not yet supported by dotnet CLI, using nuget.exe instead"
112+
& $nuget pack "$root\UnitsNet.WindowsRuntimeComponent\UnitsNet.WindowsRuntimeComponent.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir"
113+
}
103114

104115
write-host -foreground blue "Pack nugets...END`n"
105116
}

Build/build.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#>
2121
[CmdletBinding()]
2222
Param(
23-
[switch] $skipUWP
23+
[switch] $IncludeWindowsRuntimeComponent
2424
)
2525

2626
remove-module build-functions -ErrorAction SilentlyContinue
@@ -29,7 +29,7 @@ import-module $PSScriptRoot\build-functions.psm1
2929
try {
3030
Remove-ArtifactsDir
3131
Update-GeneratedCode
32-
Start-Build $skipUWP
32+
Start-Build -IncludeWindowsRuntimeComponent $IncludeWindowsRuntimeComponent
3333
Start-Tests
3434
Start-PackNugets
3535
Compress-ArtifactsAsZip
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
@echo off
2-
powershell -ExecutionPolicy Bypass -NoProfile -File %~dp0\Build\build.ps1 -skipUWP
2+
powershell -ExecutionPolicy Bypass -NoProfile -File %~dp0\Build\build.ps1 -IncludeWindowsRuntimeComponent

0 commit comments

Comments
 (0)