-
Notifications
You must be signed in to change notification settings - Fork 695
/
configure.ps1
69 lines (53 loc) · 1.7 KB
/
configure.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
<#
.SYNOPSIS
Configures NuGet.Client build environment. Detects and initializes
VS build toolsets. Configuration settings are stored at configure.json file.
.PARAMETER CleanCache
Cleans NuGet packages cache before build
.PARAMETER Force
Switch to force installation of required tools.
.PARAMETER Test
Indicates the Tests need to be run. Downloads the Test cli when tests are needed to run.
.EXAMPLE
.\configure.ps1 -cc -v
Clean repo build environment configuration
.EXAMPLE
.\configure.ps1 -v
Incremental install of build tools
#>
[CmdletBinding(SupportsShouldProcess=$True)]
Param (
[Alias('cc')]
[switch]$CleanCache,
[Alias('f')]
[switch]$Force,
[switch]$RunTest,
[switch]$SkipDotnetInfo,
[switch]$ProcDump
)
$ErrorActionPreference = 'Stop'
. "$PSScriptRoot\build\common.ps1"
Trace-Log "Configuring NuGet.Client build environment"
$BuildErrors = @()
if ($ProcDump -eq $true -Or $env:CI -eq "true")
{
Invoke-BuildStep 'Configuring Process Dump Collection' {
Install-ProcDump
} -ev +BuildErrors
}
Invoke-BuildStep 'Configuring git repo' {
Update-SubModules -Force:$Force
} -ev +BuildErrors
Invoke-BuildStep 'Installing .NET CLI' {
Install-DotnetCLI -Force:$Force -SkipDotnetInfo:$SkipDotnetInfo
} -ev +BuildErrors
Invoke-BuildStep 'Installing .NET SDKs for functional tests' {
Install-DotNetSdksForTesting -Force:$Force
} -ev +BuildErrors
Invoke-BuildStep 'Cleaning package cache' {
Clear-PackageCache
} -skip:(-not $CleanCache) -ev +BuildErrors
if ($BuildErrors) {
$ErrorLines = $BuildErrors | %{ ">>> $($_.Exception.Message)" }
Write-Error "Build's completed with $($BuildErrors.Count) error(s):`r`n$($ErrorLines -join "`r`n")" -ErrorAction Stop
}