-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBuild-All.ps1
More file actions
70 lines (61 loc) · 2.68 KB
/
Build-All.ps1
File metadata and controls
70 lines (61 loc) · 2.68 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using module "PSModules/CommonBuild/CommonBuild.psd1"
using module "PSModules/RepoBuild/RepoBuild.psd1"
<#
.SYNOPSIS
Script to build all of the code in this repo
.PARAMETER Configuration
This sets the build configuration to use, default is "Release" though for inner loop development this
may be set to "Debug".
.PARAMETER ForceClean
Forces a complete clean (Recursive delete of the build output)
.DESCRIPTION
This script is used by the automated build to perform the actual build. The Ubiquity.NET
family of projects all employ a PowerShell driven build that is generally divorced from
the automated build infrastructure used. This is done for several reasons, but the most
important ones are the ability to reproduce the build locally for inner development and
for flexibility in selecting the actual back end. The back ends have changed a few times
over the years and re-writing the entire build in terms of those back ends each time is
a lot of wasted effort. Thus, the projects settled on PowerShell as the core automated
build tooling.
#>
[cmdletbinding()]
Param(
[string]$Configuration="Release",
[switch]$ForceClean
)
$ErrorActionPreference = "Stop"
$InformationPreference = "Continue"
Push-Location $PSScriptRoot
$oldPath = $env:Path
try
{
# Pull in the repo specific support and force a full initialization of all the environment
# as this is a top level build command.
$buildInfo = Initialize-BuildEnvironment -FullInit
if(!$buildInfo -or $buildInfo -isnot [hashtable])
{
throw "build scripts BUSTED; Got null build info hashtable..."
}
if((Test-Path -PathType Container $buildInfo['BuildOutputPath']) -and $ForceClean )
{
Write-Information "Cleaning output folder from previous builds"
Remove-Item -Recurse -Force $buildInfo['BuildOutputPath'] -ProgressAction SilentlyContinue | Out-Null
}
New-Item -ItemType Directory $buildInfo['NuGetOutputPath'] -ErrorAction SilentlyContinue | Out-Null
dotnet build -c $Configuration --no-incremental 'src/Ubiquity.NET.Versioning.slnx'
}
catch
{
# everything from the official docs to the various articles in the blog-sphere says this isn't needed
# and in fact it is redundant - They're all WRONG! By re-throwing the exception the original location
# information is retained and the error reported will include the correct source file and line number
# data for the error. Without this, only the error message is retained and the location information is
# Line 1, Column 1, of the outer most script file, which is, of course, completely useless.
throw
}
finally
{
Pop-Location
$env:Path = $oldPath
}
Write-Information "Done build"