-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.ps1
51 lines (42 loc) · 1.29 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
44
45
46
47
48
49
50
51
[CmdletBinding()]
param(
[Parameter()]
[ValidateSet('Debug', 'Release')]
[string] $Configuration = 'Debug',
[Parameter()]
[ValidateSet('Build', 'Test')]
[string[]] $Task = 'Build'
)
$prev = $ErrorActionPreference
$ErrorActionPreference = 'Stop'
if (-not ('ProjectBuilder.ProjectInfo' -as [type])) {
try {
$builderPath = [IO.Path]::Combine($PSScriptRoot, 'tools', 'ProjectBuilder')
Push-Location $builderPath
dotnet @(
'publish'
'--configuration', 'Release'
'-o', 'output'
'--framework', 'netstandard2.0'
'--verbosity', 'q'
'-nologo'
)
if ($LASTEXITCODE) {
throw "Failed to compiled 'ProjectBuilder'"
}
$dll = [IO.Path]::Combine($builderPath, 'output', 'ProjectBuilder.dll')
Add-Type -Path $dll
}
finally {
Pop-Location
}
}
$projectInfo = [ProjectBuilder.ProjectInfo]::Create($PSScriptRoot, $Configuration)
$projectInfo.GetRequirements() | Import-Module -DisableNameChecking -Force
$ErrorActionPreference = $prev
$invokeBuildSplat = @{
Task = $Task
File = Convert-Path ([IO.Path]::Combine($PSScriptRoot, 'tools', 'InvokeBuild.ps1'))
ProjectInfo = $projectInfo
}
Invoke-Build @invokeBuildSplat