3 changed files
Build | ||
build.ps1 | ||
build.psake.ps1 | ||
psvcloud.depend.psd1 + | ||
Add comment 1 Minus param ($Task = 'Default')
Add comment 1 Plus [CmdletBinding()]
Add comment 2 Plus param (
Add comment 3 Plus [Parameter()]
Add comment 4 Plus [System.String[]]
Add comment 5 Plus $TaskList = 'Default',
Add comment 2 6
Add comment 3 Minus $global:VerbosePreference = "SilentlyContinue"
Add comment 7 Plus [Parameter()]
Add comment 8 Plus [System.Collections.Hashtable]
Add comment 9 Plus $Parameters,
Add comment 4 10
Add comment 5 Minus # Grab nuget bits, install modules, set build variables, start build.
Add comment 11 Plus [Parameter()]
Add comment 12 Plus [System.Collections.Hashtable]
Add comment 13 Plus $Properties
Add comment 14 Plus )
Add comment 15 Plus
Add comment 16 Plus Write-Output "`nSTARTED TASKS: $($TaskList -join ',')`n"
Add comment 17 Plus
Add comment 18 Plus # Bootstrap environment
Add comment 6 19 Get-PackageProvider -Name 'NuGet' -ForceBootstrap | Out-Null
Add comment 7 20
Add comment 8 Minus # Install modules if required
Add comment 9 Minus $ModNames = @('Psake', 'PSDeploy', 'BuildHelpers', 'PSScriptAnalyzer', 'VMware.VimAutomation.Cloud')
Add comment 10 Minus foreach ($ModName in $ModNames) {
Add comment 11 Minus if (-not (Get-Module -Name $ModName -ListAvailable)) {
Add comment 12 Minus Write-Verbose "$ModName module not installed. Installing from PSGallery..."
Add comment 13 Minus Install-Module -Name $ModName -Force -AllowClobber -Scope 'CurrentUser' > $null
Add comment 21 Plus # Install PSDepend module if it is not already installed
Add comment 22 Plus if (-not (Get-Module -Name 'PSDepend' -ListAvailable)) {
Add comment 23 Plus Install-Module -Name 'PSDepend' -Scope 'CurrentUser' -Force -Confirm:$false
Add comment 14 24 }
Add comment 15 25
Add comment 16 Minus if (-not (Get-Module -Name $ModName)) {
Add comment 17 Minus Import-Module -Name $ModName -Force
Add comment 18 Minus }
Add comment 26 Plus # Install build dependencies
Add comment 27 Plus Import-Module -Name 'PSDepend'
Add comment 28 Plus $invokePSDependParams = @{
Add comment 29 Plus Path = (Join-Path -Path $PSScriptRoot -ChildPath 'psvcloud.depend.psd1')
Add comment 30 Plus # Tags = 'Bootstrap'
Add comment 31 Plus Import = $true
Add comment 32 Plus Force = $true
Add comment 33 Plus Install = $true
Add comment 19 34 }
Add comment 35 Plus Invoke-PSDepend @invokePSDependParams
Add comment 36 Plus
Add comment 37 Plus # Init BuildHelpers
Add comment 38 Plus Set-BuildEnvironment -Force
Add comment 20 39
Add comment 21 Minus # Target latest version of Pester as older versions are bundled with OS
Add comment 22 Minus if (-not (Get-Module -Name 'Pester' -ListAvailable | Where-Object {$_.Version -match '^4.'})) {
Add comment 23 Minus Install-Module 'Pester' -MinimumVersion '4.4.2' -Force -AllowClobber -Scope 'CurrentUser' -SkipPublisherCheck -ErrorAction 'Stop'
Add comment 24 Minus }
Add comment 25 Minus if (-not (Get-Module -Name 'Pester')) {
Add comment 26 Minus Import-Module -Name 'Pester' -Force
Add comment 40 Plus # Execute PSake tasts
Add comment 41 Plus $invokePsakeParams = @{
Add comment 42 Plus buildFile = (Join-Path -Path $ENV:BHProjectPath -ChildPath 'Build\build.psake.ps1')
Add comment 43 Plus nologo = $true
Add comment 27 44 }
Add comment 28 Minus
Add comment 29 Minus Set-BuildEnvironment
Add comment 45 Plus Invoke-Psake @invokePsakeParams @PSBoundParameters
Add comment 30 46
Add comment 31 Minus Invoke-psake -buildFile $ENV:BHProjectPath\Build\build.psake.ps1 -taskList $Task -nologo
Add comment 47 Plus Write-Output "`nFINISHED TASKS: $($TaskList -join ',')"
Add comment 32 48 exit ( [int]( -not $psake.build_success ) )
Add comment 33 49
Add comment 16
Add comment 17 # Pester
Add comment 18 $TestRootDir = "$ProjectRoot\Tests"
Add comment 19 Minus $TestScripts = Get-ChildItem "$ProjectRoot\Tests\*Tests.ps1"
Add comment 19 Plus $TestScripts = Get-ChildItem "$ProjectRoot\Tests\*\*Tests.ps1"
Add comment 20 $TestFile = "$($TimeStamp)_UnitTestResults.xml"
Add comment 21
Add comment 22 # Script Analyzer
Add comment 1 Plus @{
Add comment 2 Plus # Defaults for all dependencies
Add comment 3 Plus PSDependOptions = @{
Add comment 4 Plus Target = 'CurrentUser'
Add comment 5 Plus Parameters = @{
Add comment 6 Plus # Use a local repository for offline support
Add comment 7 Plus Repository = 'PSGallery'
Add comment 8 Plus SkipPublisherCheck = $true
Add comment 9 Plus }
Add comment 10 Plus }
Add comment 11 Plus
Add comment 12 Plus # Dependency Management modules
Add comment 13 Plus # PackageManagement = '1.2.2'
Add comment 14 Plus # PowerShellGet = '2.0.1'
Add comment 15 Plus
Add comment 16 Plus # Common modules
Add comment 17 Plus BuildHelpers = '2.0.1'
Add comment 18 Plus Pester = '4.4.2'
Add comment 19 Plus PlatyPS = '0.12.0'
Add comment 20 Plus psake = '4.7.4 '
Add comment 21 Plus PSDeploy = '1.0.1 '
Add comment 22 Plus PSScriptAnalyzer = '1.17.1'
Add comment 23 Plus 'VMware.VimAutomation.Cloud' = 'Latest'
Add comment 24 Plus }
Add comment 25 Plus