Skip to content

Commit

Permalink
Add build-skip-uwp.bat
Browse files Browse the repository at this point in the history
Skips building the UWP (Windows Runtime Component) target, as this requires
extra Visual Studio features many don't have.
  • Loading branch information
angularsen committed Jan 21, 2018
1 parent 2706608 commit 44fe85b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
17 changes: 12 additions & 5 deletions Build/build-functions.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,22 @@ function Update-GeneratedCode {
write-host -foreground blue "Generate code...END`n"
}

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

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

write-host -foreground blue "Start-Build...END`n"
}
Expand Down
18 changes: 11 additions & 7 deletions Build/build.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<#
<#
.SYNOPSIS
Build, run tests and pack nugets for all Units.NET projects.
.DESCRIPTION
Expand All @@ -7,17 +7,21 @@
Publishing nugets is handled by nuget-publish.bat and run by the build server
on the master branch.
Optional strong name signing .pfx key file to produce signed binaries for the signed nugets.
.PARAMETER skipUWP
If flag is set, will skip the UWP (Windows Runtime Component) build step as this requires
some large, extra Visual Studio features to be installed.
.EXAMPLE
powershell ./UpdateAssemblyInfo.ps1 c:\UnitsNet_Key.snk
powershell ./build.ps1
powershell ./build.ps1 -skipUWP
.NOTES
Author: Andreas Gullberg Larsen
Last modified: June 1, 2017
Last modified: Jan 21, 2018
#>
[CmdletBinding()]
Param()
Param(
[switch] $skipUWP
)

remove-module build-functions -ErrorAction SilentlyContinue
import-module $PSScriptRoot\build-functions.psm1
Expand All @@ -26,7 +30,7 @@ try {
Remove-ArtifactsDir
Start-NugetRestore
Update-GeneratedCode
Start-Build
Start-Build $skipUWP
Start-Tests
Start-PackNugets
Compress-ArtifactsAsZip
Expand Down
2 changes: 2 additions & 0 deletions build-skip-uwp.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
powershell -ExecutionPolicy Bypass -NoProfile -File %~dp0\Build\build.ps1 -skipUWP

0 comments on commit 44fe85b

Please sign in to comment.