From c33e1ff82882cadba6cb9885c577d84347a73145 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Wed, 21 Mar 2018 14:24:44 -0700 Subject: [PATCH] Make '-CI' not depend on '-PSModuleRestore' in 'Start-PSBuild' (#6450) --- build.psm1 | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/build.psm1 b/build.psm1 index 43d9363ce1..f0331ba8d0 100644 --- a/build.psm1 +++ b/build.psm1 @@ -635,9 +635,13 @@ Fix steps: # download modules from powershell gallery. # - PowerShellGet, PackageManagement, Microsoft.PowerShell.Archive - if($PSModuleRestore) - { - Restore-PSModuleToBuild -PublishPath $publishPath -CI:$CI.IsPresent + if ($PSModuleRestore) { + Restore-PSModuleToBuild -PublishPath $publishPath + } + + # Restore the Pester module + if ($CI) { + Restore-PSPester -Destination (Join-Path $publishPath "Modules") } } @@ -646,22 +650,12 @@ function Restore-PSModuleToBuild param( [Parameter(Mandatory)] [string] - $PublishPath, - [Switch] - $CI + $PublishPath ) Write-Log "Restore PowerShell modules to $publishPath" - $modulesDir = Join-Path -Path $publishPath -ChildPath "Modules" - Copy-PSGalleryModules -Destination $modulesDir - - if($CI.IsPresent) - { - # take the latest version of pester and install it so it may be used - Restore-PSPester -Destination $modulesDir - } } function Restore-PSPester