-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.ps1
72 lines (57 loc) · 1.98 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
62
63
64
65
66
67
68
69
70
71
72
[CmdletBinding()]
param (
[Parameter()]
[System.String[]]
$TaskList = 'Default',
[Parameter()]
[System.Collections.Hashtable]
$Parameters,
[Parameter()]
[System.Collections.Hashtable]
$Properties,
[Parameter()]
[Switch]
$ResolveDependency
)
Write-Output "`nSTARTED TASKS: $($TaskList -join ',')`n"
Write-Output "`nPowerShell Version Information:"
$PSVersionTable
# Load dependencies
if ($PSBoundParameters.Keys -contains 'ResolveDependency') {
# Bootstrap environment
Get-PackageProvider -Name 'NuGet' -ForceBootstrap | Out-Null
# Install PSDepend module if it is not already installed
if (-not (Get-Module -Name 'PSDepend' -ListAvailable)) {
Write-Output "`nPSDepend is not yet installed...installing PSDepend now..."
Install-Module -Name 'PSDepend' -Scope 'CurrentUser' -Force
} else {
Write-Output "`nPSDepend already installed...skipping."
}
# Install build dependencies
$psdependencyConfigPath = Join-Path -Path $PSScriptRoot -ChildPath 'build.depend.psd1'
Write-Output "Checking / resolving module dependencies from [$psdependencyConfigPath]..."
Import-Module -Name 'PSDepend'
$invokePSDependParams = @{
Path = $psdependencyConfigPath
# Tags = 'Bootstrap'
Import = $true
Confirm = $false
Install = $true
# Verbose = $true
}
Invoke-PSDepend @invokePSDependParams
# Remove ResolveDependency PSBoundParameter ready for passthru to PSake
$PSBoundParameters.Remove('ResolveDependency')
} else {
Write-Host "Skipping dependency check...`n" -ForegroundColor 'Yellow'
}
# Init BuildHelpers
Set-BuildEnvironment -Force
# Execute PSake tasts
$invokePsakeParams = @{
buildFile = (Join-Path -Path $env:BHProjectPath -ChildPath 'Build\build.psake.ps1')
nologo = $true
}
Invoke-Psake @invokePsakeParams @PSBoundParameters
Write-Output "`nFINISHED TASKS: $($TaskList -join ',')"
exit ( [int](-not $psake.build_success) )