-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBuild.ps1
43 lines (38 loc) · 1.28 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
[CmdletBinding()]
param (
[Parameter()]
[ValidateSet('Debug', 'Release')]
[string]$Configuration = 'Debug'
)
$ErrorActionPreference = 'Stop'
# Ensure the NuGet package provider is installed and the PSGallery repository is trusted.
if (!(Get-PackageProvider -Name 'NuGet' -ForceBootstrap)) {
Write-Verbose 'Installing NuGet package provider' -Verbose
$packageProviderParams = @{
Name = 'NuGet'
Force = $true
ForceBootstrap = $true
}
$null = Install-PackageProvider @packageProviderParams
}
Write-Verbose 'Setting PowerShell Gallery as a trusted PSRepository' -Verbose
Set-PSRepository -Name 'PSGallery' -InstallationPolicy 'Trusted'
# Bootstrap PSDepend module which will be used to download other dependent modules.
if (!(Get-Module -Name 'PSDepend' -ListAvailable)) {
Write-Verbose 'Bootstrapping PSDepend module from PowerShell Gallery' -Verbose
$installPSDependParams = @{
Name = 'PSDepend'
Scope = 'CurrentUser'
AllowClobber = $true
Force = $true
Confirm = $false
}
Install-Module @installPSDependParams
}
Write-Verbose 'Resolving dependencies and installing any required modules' -Verbose
$psDependParams = @{
Path = "$PSScriptRoot\PSDepend.build.psd1"
Force = $true
}
Invoke-PSDepend @psDependParams
Invoke-Build -Task *