-
Notifications
You must be signed in to change notification settings - Fork 11
/
Build-All.ps1
94 lines (81 loc) · 3.55 KB
/
Build-All.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<#
.SYNOPSIS
Script to build all of the LLvm.NET code base
.PARAMETER Configuration
This sets the build configuration to use, default is "Release" though for inner loop development this may be set to "Debug"
.PARAMETER AllowVsPreReleases
Switch to enable use of Visual Studio Pre-Release versions. This is NEVER enabled for official production builds, however it is
useful when adding support for new versions during the pre-release stages.
.PARAMETER ForceClean
Forces a complete clean (Recursive delete of the build output)
.PARAMETER BuildMode
Specifies the build mode, which may be one of the following:
|Name | Description |
|--------|---------------------------------------------------------------------------|
| Source | Builds only the source code. This is useful for local development. |
| Docs | Builds only the docs. Saves on build time when only updating docs topics. |
| All | [Default] Builds everything |
.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]$AllowVsPreReleases,
[switch]$ForceClean,
[ValidateSet('All','Source','Docs')]
[System.String]$BuildMode = 'All'
)
pushd $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.
. .\repo-buildutils.ps1
$buildInfo = Initialize-BuildEnvironment -FullInit -AllowVsPreReleases:$AllowVsPreReleases
$BuildSource = $false
$BuildDocs = $false;
switch($BuildMode)
{
'All' { $BuildSource = $true; $BuildDocs = $true; }
'Source' { $BuildSource = $true }
'Docs' { $BuildDocs = $true }
}
if((Test-Path -PathType Container $buildInfo['BuildOutputPath']) -and $ForceClean )
{
Write-Information "Cleaning output folder from previous builds"
rd -Recurse -Force -Path $buildInfo['BuildOutputPath']
}
md $buildInfo['NuGetOutputPath'] -ErrorAction SilentlyContinue | Out-Null
if($BuildSource)
{
.\Build-Source.ps1 -AllowVsPreReleases:$AllowVsPreReleases
}
if($BuildDocs)
{
.\Build-Docs.ps1 -AllowVsPreReleases:$AllowVsPreReleases
}
}
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
{
popd
$env:Path = $oldPath
}
Write-Information "Done build"