Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 3 additions & 29 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ function Restore-PSPester
[ValidateNotNullOrEmpty()]
[string] $Destination = ([IO.Path]::Combine((Split-Path (Get-PSOptions -DefaultToNew).Output), "Modules"))
)
Copy-PSGalleryModules -Destination $Destination -ModuleNames Pester
Save-Module -Name Pester -Path $Destination -Repository PSGallery
}

function Compress-TestContent {
Expand Down Expand Up @@ -2303,15 +2303,9 @@ function Copy-PSGalleryModules
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]$Destination,

[Parameter()]
[ValidateNotNullOrEmpty()]
[string[]]$ModuleNames
[string]$Destination
)

$ModulesOnlyForCI = @("Pester")

if (!$Destination.EndsWith("Modules")) {
throw "Installing to an unexpected location"
}
Expand All @@ -2329,15 +2323,6 @@ function Copy-PSGalleryModules
foreach ($m in $psGalleryProj.Project.ItemGroup.PackageReference) {
$name = $m.Include
$version = $m.Version

if ($null -ne $ModuleNames) {
# When '-ModuleNames' is specified, then we only copy those specified modules
if ($name -notin $ModuleNames) { continue }
} else {
# When '-ModuleNames' is NOT specified, copy all modules except the CI-only ones
if ($name -in $ModulesOnlyForCI) { continue }
}

log "Name='$Name', Version='$version', Destination='$Destination'"

# Remove the build revision from the src (nuget drops it).
Expand All @@ -2361,18 +2346,7 @@ function Copy-PSGalleryModules
Remove-Item -Force -ErrorAction Ignore -Recurse "$Destination/$name"
New-Item -Path $dest -ItemType Directory -Force -ErrorAction Stop > $null
$dontCopy = '*.nupkg', '*.nupkg.sha512', '*.nuspec', 'System.Runtime.InteropServices.RuntimeInformation.dll'

switch ($name)
{
"Pester" {
$toolsDir = Join-Path -Path $src -ChildPath "tools"
Copy-Item -Path $toolsDir/* -Destination $dest -Recurse -Force
}

default {
Copy-Item -Exclude $dontCopy -Recurse $src/* $dest
}
}
Copy-Item -Exclude $dontCopy -Recurse $src/* $dest
}
}

Expand Down
1 change: 0 additions & 1 deletion src/Modules/PSGalleryModules.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<PackageReference Include="PackageManagement" Version="1.1.7.0" />
<PackageReference Include="PowerShellGet" Version="1.6.0" />
<PackageReference Include="Microsoft.PowerShell.Archive" Version="1.1.0.0" />
<PackageReference Include="Pester" Version="4.3.1" />
</ItemGroup>

</Project>