forked from NuGet/NuGet.Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ps1
60 lines (46 loc) · 1.46 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
<#
.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
)
$ErrorActionPreference = 'Stop'
. "$PSScriptRoot\build\common.ps1"
Trace-Log "Configuring NuGet.Client build environment"
$BuildErrors = @()
Invoke-BuildStep 'Configuring git repo' {
Update-SubModules -Force:$Force
} -ev +BuildErrors
Invoke-BuildStep 'Installing .NET CLI' {
Install-DotnetCLI -Force:$Force
} -ev +BuildErrors
# Restoring tools required for build
Invoke-BuildStep 'Restoring solution packages' {
Restore-SolutionPackages
} -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
}