Skip to content

Commit 44fe85b

Browse files
committed
Add build-skip-uwp.bat
Skips building the UWP (Windows Runtime Component) target, as this requires extra Visual Studio features many don't have.
1 parent 2706608 commit 44fe85b

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

Build/build-functions.psm1

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,22 @@ function Update-GeneratedCode {
3535
write-host -foreground blue "Generate code...END`n"
3636
}
3737

38-
function Start-Build {
38+
function Start-Build([boolean] $skipUWP = $false) {
3939
write-host -foreground blue "Start-Build...`n---"
4040
dotnet build --configuration Release "$root\UnitsNet.sln"
4141
if ($lastexitcode -ne 0) { exit 1 }
4242

43-
# dontnet CLI does not support WindowsRuntimeComponent project type yet
44-
write-host -foreground yellow "WindowsRuntimeComponent project not yet supported by dotnet CLI, using MSBuild15 instead"
45-
& msbuild "$root\UnitsNet.WindowsRuntimeComponent.sln" /verbosity:minimal /p:Configuration=Release
46-
if ($lastexitcode -ne 0) { exit 1 }
43+
if ($skipUWP -eq $true)
44+
{
45+
write-host -foreground yellow "Skipping WindowsRuntimeComponent build by user-specified flag."
46+
}
47+
else
48+
{
49+
# dontnet CLI does not support WindowsRuntimeComponent project type yet
50+
write-host -foreground yellow "WindowsRuntimeComponent project not yet supported by dotnet CLI, using MSBuild15 instead"
51+
& "$msbuild" "$root\UnitsNet.WindowsRuntimeComponent.sln" /verbosity:minimal /p:Configuration=Release
52+
if ($lastexitcode -ne 0) { exit 1 }
53+
}
4754

4855
write-host -foreground blue "Start-Build...END`n"
4956
}

Build/build.ps1

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#
1+
<#
22
.SYNOPSIS
33
Build, run tests and pack nugets for all Units.NET projects.
44
.DESCRIPTION
@@ -7,17 +7,21 @@
77
88
Publishing nugets is handled by nuget-publish.bat and run by the build server
99
on the master branch.
10-
11-
Optional strong name signing .pfx key file to produce signed binaries for the signed nugets.
10+
.PARAMETER skipUWP
11+
If flag is set, will skip the UWP (Windows Runtime Component) build step as this requires
12+
some large, extra Visual Studio features to be installed.
1213
.EXAMPLE
13-
powershell ./UpdateAssemblyInfo.ps1 c:\UnitsNet_Key.snk
14+
powershell ./build.ps1
15+
powershell ./build.ps1 -skipUWP
1416
1517
.NOTES
1618
Author: Andreas Gullberg Larsen
17-
Last modified: June 1, 2017
19+
Last modified: Jan 21, 2018
1820
#>
1921
[CmdletBinding()]
20-
Param()
22+
Param(
23+
[switch] $skipUWP
24+
)
2125

2226
remove-module build-functions -ErrorAction SilentlyContinue
2327
import-module $PSScriptRoot\build-functions.psm1
@@ -26,7 +30,7 @@ try {
2630
Remove-ArtifactsDir
2731
Start-NugetRestore
2832
Update-GeneratedCode
29-
Start-Build
33+
Start-Build $skipUWP
3034
Start-Tests
3135
Start-PackNugets
3236
Compress-ArtifactsAsZip

build-skip-uwp.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@echo off
2+
powershell -ExecutionPolicy Bypass -NoProfile -File %~dp0\Build\build.ps1 -skipUWP

0 commit comments

Comments
 (0)