forked from dotnet/Nerdbank.GitVersioning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.ps1
48 lines (41 loc) · 1.56 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<#
.SYNOPSIS
Restores all NuGet, NPM and Typings packages necessary to build this repository.
#>
[CmdletBinding(SupportsShouldProcess)]
Param(
)
$oldPlatform=$env:Platform
$env:Platform='AnyCPU' # Some people wander in here from a platform-specific build window.
Push-Location $PSScriptRoot
try {
$toolsPath = "$PSScriptRoot\tools"
# First restore NuProj packages since the solution restore depends on NuProj evaluation succeeding.
gci "$PSScriptRoot\src\project.json" -rec |? { $_.FullName -imatch 'nuget' } |% {
& "$toolsPath\Restore-NuGetPackages.ps1" -Path $_ -Verbosity Quiet
}
# Restore VS2017 style to get the rest of the projects.
msbuild "$PSScriptRoot\src\NerdBank.GitVersioning.Tests\NerdBank.GitVersioning.Tests.csproj" /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", "npm install")) {
npm install --loglevel error
}
Write-Host "Restoring Typings..." -ForegroundColor Yellow
if ($PSCmdlet.ShouldProcess("$PSScriptRoot\src\nerdbank-gitversioning.npm", "typings install")) {
.\node_modules\.bin\typings install
}
} finally {
Pop-Location
}
Write-Host "Successfully restored all dependencies" -ForegroundColor Yellow
}
catch {
Write-Error "Aborting script due to error"
exit $lastexitcode
}
finally {
$env:Platform=$oldPlatform
Pop-Location
}