forked from dotnet/Nerdbank.GitVersioning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.ps1
33 lines (29 loc) · 958 Bytes
/
init.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
<#
.SYNOPSIS
Restores all NuGet, NPM and Typings packages necessary to build this repository.
#>
[CmdletBinding(SupportsShouldProcess)]
Param(
)
$oldPlatform=$env:Platform
$env:Platform='Any CPU' # Some people wander in here from a platform-specific build window.
Push-Location $PSScriptRoot
try {
msbuild "$PSScriptRoot\src" /t:restore /v:minimal /m /nologo
Write-Host "Restoring NPM packages..." -ForegroundColor Yellow
Push-Location "$PSScriptRoot\src\nerdbank-gitversioning.npm"
try {
if ($PSCmdlet.ShouldProcess("$PSScriptRoot\src\nerdbank-gitversioning.npm", "yarn install")) {
yarn install --loglevel error
}
} finally {
Pop-Location
}
Write-Host "Successfully restored all dependencies" -ForegroundColor Yellow
} catch {
# we have the try so that PS fails when we get failure exit codes from build steps.
throw;
} finally {
$env:Platform=$oldPlatform
Pop-Location
}