-
-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathbuild.ps1
More file actions
62 lines (59 loc) · 2.12 KB
/
build.ps1
File metadata and controls
62 lines (59 loc) · 2.12 KB
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
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSReviewUnusedParameter',
'Command',
Justification = 'false positive'
)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSReviewUnusedParameter',
'Parameter',
Justification = 'false positive'
)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSReviewUnusedParameter',
'CommandAst',
Justification = 'false positive'
)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSReviewUnusedParameter',
'FakeBoundParams',
Justification = 'false positive'
)]
[CmdletBinding(DefaultParameterSetName = 'task')]
param(
[parameter(ParameterSetName = 'task', Position = 0)]
[ArgumentCompleter( {
param($Command, $Parameter, $WordToComplete, $CommandAst, $FakeBoundParams)
try {
Get-PSakeScriptTasks -BuildFile './psakeFile.ps1' -ErrorAction 'Stop' |
Where-Object { $_.Name -like "$WordToComplete*" } |
Select-Object -ExpandProperty 'Name'
} catch {
@()
}
})]
[string[]]$Task = 'default',
[switch]$Bootstrap,
[parameter(ParameterSetName = 'Help')]
[switch]$Help
)
$ErrorActionPreference = 'Stop'
$psakeFile = './psakeFile.ps1'
if ($Bootstrap) {
if (-not (Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) {
Install-PackageProvider -Name NuGet -Force -Scope CurrentUser | Out-Null
}
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
if (-not (Get-Module -Name PSDepend -ListAvailable)) {
Install-Module -Name PSDepend -Repository PSGallery -Scope CurrentUser -Force -RequiredVersion '0.3.8'
}
Import-Module -Name PSDepend -Verbose:$false
Invoke-PSDepend -Path './requirements.psd1' -Install -Import -Force -WarningAction SilentlyContinue
}
if ($PSCmdlet.ParameterSetName -eq 'Help') {
Get-PSakeScriptTasks -BuildFile $psakeFile |
Format-Table -Property Name, Description, Alias, DependsOn
} else {
Set-BuildEnvironment -Force
Invoke-Psake -BuildFile $psakeFile -TaskList $Task -NoLogo
exit ([int](-not $psake.build_success))
}