-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
43 lines (35 loc) · 1.15 KB
/
build.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
#!/usr/bin/env pwsh
#Requires -Version 5.1
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
function GuardBin {
param (
[string]$binary,
[string]$message
)
if ($null -eq (Get-Command $binary -ErrorAction Ignore)) {
throw "Could not find '$binary'; $message"
}
}
GuardBin git "please install the Git CLI from https://git-scm.com/"
GuardBin dotnet "please install the .NET SDK from https://dot.net/"
GuardBin npm "please install Node and npm from (https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)"
GuardBin docker "please install Docker from (https://docs.docker.com/engine/install/)"
$version = [Version]$([regex]::matches((&dotnet --version), '^(\d+\.)?(\d+\.)?(\*|\d+)').value)
if ($version.Major -lt 9) {
throw ".NET SDK version ($version) is too low; please install version 9.0 from https://dot.net/"
}
& git submodule status | ForEach-Object {
if ($_[0] -eq '-') {
$pieces = $_.Split(' ')
& git submodule update --init "$($pieces[1])"
Write-Host ""
}
}
Push-Location (Split-Path $MyInvocation.MyCommand.Definition)
try {
& dotnet run --project tools/builder --no-launch-profile -- $args
}
finally {
Pop-Location
}