-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild.ps1
52 lines (48 loc) · 1.41 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
#Requires -Version 3.0
[CmdletBinding(
DefaultParameterSetName = 'Task'
)]
param (
[parameter(
ParameterSetName = 'Task',
Position = 0
)]
[string[]]
# Build task(s) to execute
$Task = 'default',
[parameter(
ParameterSetName = 'Task'
)]
[switch]
# Bootstrap dependencies
$Bootstrap,
[parameter(
Mandatory,
ParameterSetName = 'Help'
)]
[switch]
# List available build tasks
$Help
)
$ErrorActionPreference = 'Stop'
# Bootstrap dependencies
if ($Bootstrap.IsPresent) {
$null = Get-PackageProvider -Name Nuget -ForceBootstrap
# Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
if (-not (Get-Module -Name PSDepend -ListAvailable)) {
Install-Module -Name PSDepend -Repository PSGallery -Force
}
Import-Module -Name PSDepend -Verbose:$false
Invoke-PSDepend -Path './requirements.psd1' -Install -Import -Force -WarningAction SilentlyContinue
}
# Execute psake task(s)
$psakeFile = Join-Path -Path $PSScriptRoot -ChildPath 'psakeFile.ps1'
if ($Help.IsPresent) {
Get-PSakeScriptTasks -buildFile $psakeFile |
Where-Object Description |
Select-Object -Property Name, Description, Alias
exit
} else {
Invoke-psake -buildFile $psakeFile -taskList $Task -nologo
exit ( [int]( -not $psake.build_success ) )
}