mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix release packaging build (#6459)
The release packaging build needs to have 'dotnet' in path, fixed that by adding Find-DotNet Refactored restore logic so it can be used from both Start-PSBuild and Copy-PSGalleryModules
This commit is contained in:
+39
-15
@@ -525,21 +525,7 @@ Fix steps:
|
||||
}
|
||||
|
||||
# handle Restore
|
||||
if ($Restore -or -not (Test-Path "$($Options.Top)/obj/project.assets.json")) {
|
||||
$srcProjectDirs = @($Options.Top, "$PSScriptRoot/src/TypeCatalogGen", "$PSScriptRoot/src/ResGen", "$PSScriptRoot/src/Modules")
|
||||
|
||||
$RestoreArguments = @("--runtime",$Options.Runtime,"--verbosity")
|
||||
if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) {
|
||||
$RestoreArguments += "detailed"
|
||||
} else {
|
||||
$RestoreArguments += "quiet"
|
||||
}
|
||||
|
||||
$srcProjectDirs | ForEach-Object {
|
||||
Write-Log "Run dotnet restore $_ $RestoreArguments"
|
||||
Start-NativeExecution { dotnet restore $_ $RestoreArguments }
|
||||
}
|
||||
}
|
||||
Restore-PSPackage -Options $Options -Force:$Restore
|
||||
|
||||
# handle ResGen
|
||||
# Heuristic to run ResGen on the fresh machine
|
||||
@@ -641,6 +627,41 @@ Fix steps:
|
||||
}
|
||||
}
|
||||
|
||||
function Restore-PSPackage
|
||||
{
|
||||
param(
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Parameter()]
|
||||
[string[]] $ProjectDirs,
|
||||
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Parameter()]
|
||||
$Options = (Get-PSOptions -DefaultToNew),
|
||||
|
||||
[switch] $Force
|
||||
)
|
||||
|
||||
if (-not $ProjectDirs)
|
||||
{
|
||||
$ProjectDirs = @($Options.Top, "$PSScriptRoot/src/TypeCatalogGen", "$PSScriptRoot/src/ResGen", "$PSScriptRoot/src/Modules")
|
||||
}
|
||||
|
||||
if ($Force -or (-not (Test-Path "$($Options.Top)/obj/project.assets.json"))) {
|
||||
|
||||
$RestoreArguments = @("--runtime",$Options.Runtime,"--verbosity")
|
||||
if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) {
|
||||
$RestoreArguments += "detailed"
|
||||
} else {
|
||||
$RestoreArguments += "quiet"
|
||||
}
|
||||
|
||||
$ProjectDirs | ForEach-Object {
|
||||
Write-Log "Run dotnet restore $_ $RestoreArguments"
|
||||
Start-NativeExecution { dotnet restore $_ $RestoreArguments }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Restore-PSModuleToBuild
|
||||
{
|
||||
param(
|
||||
@@ -2331,6 +2352,9 @@ function Copy-PSGalleryModules
|
||||
throw "Installing to an unexpected location"
|
||||
}
|
||||
|
||||
Find-DotNet
|
||||
Restore-PSPackage
|
||||
|
||||
$cache = dotnet nuget locals global-packages -l
|
||||
if ($cache -match "info : global-packages: (.*)") {
|
||||
$nugetCache = $matches[1]
|
||||
|
||||
Reference in New Issue
Block a user