-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.ps1
61 lines (53 loc) · 1.66 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
52
53
54
55
56
57
58
59
60
61
[CmdletBinding()]
param(
[Parameter()]
[ValidateSet('Debug', 'Release')]
[string] $Configuration = 'Release',
[Parameter()]
[switch] $Force,
[Parameter()]
[switch] $Publish
)
end {
$IsUnix = $PSEdition -eq 'Core' -and -not $IsWindows
$requirements = Import-PowerShellDataFile $PSScriptRoot\requirements.psd1
foreach ($requirement in $requirements.GetEnumerator()) {
if ($requirement.Key -match 'Dotnet') {
$global:dotnet = & "$PSScriptRoot/tools/GetDotNet.ps1" -Version $requirement.Value -Unix:$IsUnix
continue
}
$importModuleSplat = @{
MinimumVersion = $requirement.Value
Force = $true
ErrorAction = 'Ignore'
PassThru = $true
Name = $requirement.Key
}
if (-not (Import-Module @importModuleSplat)) {
$installModuleSplat = @{
MinimumVersion = $requirement.Value
Scope = 'CurrentUser'
AllowClobber = $true
AllowPrerelease = $true
SkipPublisherCheck = $true
Force = $true
Name = $requirement.Key
}
Install-Module @installModuleSplat -ErrorAction Stop
$importModuleSplat['ErrorAction'] = 'Stop'
$null = Import-Module @importModuleSplat
}
}
if ($Publish) {
$ibTask = 'Publish'
} else {
$ibTask = 'Test'
}
$invokeBuildSplat = @{
Task = $ibTask
File = "$PSScriptRoot/ILAssembler.build.ps1"
Force = $Force.IsPresent
Configuration = $Configuration
}
Invoke-Build @invokeBuildSplat
}