forked from Humanizr/Humanizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
42 lines (36 loc) · 1.28 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
param(
[string]$target = "Test",
[string]$verbosity = "minimal",
[int]$maxCpuCount = 0
)
# Kill all MSBUILD.EXE processes because they could very likely have a lock against our
# MSBuild runner from when we last ran unit tests.
get-process -name "msbuild" -ea SilentlyContinue | %{ stop-process $_.ID -force }
$msbuilds = @(get-command msbuild -ea SilentlyContinue)
if ($msbuilds.Count -gt 0) {
$msbuild = $msbuilds[0].Definition
}
else {
if (test-path "env:\ProgramFiles(x86)") {
$path = join-path ${env:ProgramFiles(x86)} "MSBuild\14.0\bin\MSBuild.exe"
if (test-path $path) {
$msbuild = $path
}
}
if ($msbuild -eq $null) {
$path = join-path $env:ProgramFiles "MSBuild\14.0\bin\MSBuild.exe"
if (test-path $path) {
$msbuild = $path
}
}
if ($msbuild -eq $null) {
throw "MSBuild could not be found in the path. Please ensure MSBuild v14 (from Visual Studio 2015) is in the path."
}
}
if ($maxCpuCount -lt 1) {
$maxCpuCountText = $Env:MSBuildProcessorCount
} else {
$maxCpuCountText = ":$maxCpuCount"
}
$allArgs = @("build.proj", "/m$maxCpuCountText", "/nologo", "/verbosity:$verbosity", "/t:$target", "/property:RequestedVerbosity=$verbosity", $args)
& $msbuild $allArgs