mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
[release/v7.4]Make Component Manifest Updater use neutral target in addition to RID target (#25100)
This commit is contained in:
@@ -211,28 +211,34 @@ function Get-CGRegistrations {
|
||||
"alpine-.*" {
|
||||
$folder = $unixProjectName
|
||||
$target = "$dotnetTargetName|$Runtime"
|
||||
$neutralTarget = "$dotnetTargetName"
|
||||
}
|
||||
"linux-.*" {
|
||||
$folder = $unixProjectName
|
||||
$target = "$dotnetTargetName|$Runtime"
|
||||
$neutralTarget = "$dotnetTargetName"
|
||||
}
|
||||
"osx-.*" {
|
||||
$folder = $unixProjectName
|
||||
$target = "$dotnetTargetName|$Runtime"
|
||||
$neutralTarget = "$dotnetTargetName"
|
||||
}
|
||||
"win-x*" {
|
||||
$sdkToUse = $winDesktopSdk
|
||||
$folder = $windowsProjectName
|
||||
$target = "$dotnetTargetNameWin7|$Runtime"
|
||||
$neutralTarget = "$dotnetTargetNameWin7"
|
||||
}
|
||||
"win-.*" {
|
||||
$folder = $windowsProjectName
|
||||
$target = "$dotnetTargetNameWin7|$Runtime"
|
||||
$neutralTarget = "$dotnetTargetNameWin7"
|
||||
}
|
||||
"modules" {
|
||||
$folder = "modules"
|
||||
$actualRuntime = 'linux-x64'
|
||||
$target = "$dotnetTargetName|$actualRuntime"
|
||||
$neutralTarget = "$dotnetTargetName"
|
||||
}
|
||||
Default {
|
||||
throw "Invalid runtime name: $Runtime"
|
||||
@@ -249,6 +255,7 @@ function Get-CGRegistrations {
|
||||
$null = New-PADrive -Path $PSScriptRoot\..\src\$folder\obj\project.assets.json -Name $folder
|
||||
try {
|
||||
$targets = Get-ChildItem -Path "${folder}:/targets/$target" -ErrorAction Stop | Where-Object { $_.Type -eq 'package' } | select-object -ExpandProperty name
|
||||
$targets += Get-ChildItem -Path "${folder}:/targets/$neutralTarget" -ErrorAction Stop | Where-Object { $_.Type -eq 'project' } | select-object -ExpandProperty name
|
||||
} catch {
|
||||
Get-ChildItem -Path "${folder}:/targets" | Out-String | Write-Verbose -Verbose
|
||||
throw
|
||||
@@ -260,38 +267,49 @@ function Get-CGRegistrations {
|
||||
|
||||
# Name to skip for TPN generation
|
||||
$skipNames = @(
|
||||
"Microsoft.PowerShell.Native",
|
||||
"Microsoft.Management.Infrastructure.Runtime.Unix",
|
||||
"Microsoft.PowerShell.Native"
|
||||
"Microsoft.Management.Infrastructure.Runtime.Unix"
|
||||
"Microsoft.Management.Infrastructure"
|
||||
"Microsoft.PowerShell.Commands.Diagnostics"
|
||||
"Microsoft.PowerShell.Commands.Management"
|
||||
"Microsoft.PowerShell.Commands.Utility"
|
||||
"Microsoft.PowerShell.ConsoleHost"
|
||||
"Microsoft.PowerShell.SDK"
|
||||
"Microsoft.PowerShell.Security"
|
||||
"Microsoft.Management.Infrastructure.CimCmdlets"
|
||||
"Microsoft.WSMan.Management"
|
||||
"Microsoft.WSMan.Runtime"
|
||||
"System.Management.Automation"
|
||||
)
|
||||
|
||||
Write-Verbose "Found $($targets.Count) targets to process..." -Verbose
|
||||
$targets | ForEach-Object {
|
||||
$target = $_
|
||||
$parts = ($target -split '\|')
|
||||
$name = $parts[0]
|
||||
|
||||
if ($name -in $skipNames) {
|
||||
Write-Verbose -Verbose "Skipping $name..."
|
||||
continue
|
||||
}
|
||||
Write-Verbose "Skipping $name..."
|
||||
|
||||
$targetVersion = $parts[1]
|
||||
$publicVersion = Get-NuGetPublicVersion -Name $name -Version $targetVersion
|
||||
} else {
|
||||
$targetVersion = $parts[1]
|
||||
$publicVersion = Get-NuGetPublicVersion -Name $name -Version $targetVersion
|
||||
|
||||
# Add the registration to the cgmanifest if the TPN does not contain the name of the target OR
|
||||
# the exisitng CG contains the registration, because if the existing CG contains the registration,
|
||||
# that might be the only reason it is in the TPN.
|
||||
if (!$RegistrationTable.ContainsKey($target)) {
|
||||
$DevelopmentDependency = $false
|
||||
if (!$existingRegistrationTable.ContainsKey($name) -or $existingRegistrationTable.$name.Component.Version() -ne $publicVersion) {
|
||||
$registrationChanged = $true
|
||||
# Add the registration to the cgmanifest if the TPN does not contain the name of the target OR
|
||||
# the exisitng CG contains the registration, because if the existing CG contains the registration,
|
||||
# that might be the only reason it is in the TPN.
|
||||
if (!$RegistrationTable.ContainsKey($target)) {
|
||||
$DevelopmentDependency = $false
|
||||
if (!$existingRegistrationTable.ContainsKey($name) -or $existingRegistrationTable.$name.Component.Version() -ne $publicVersion) {
|
||||
$registrationChanged = $true
|
||||
}
|
||||
if ($existingRegistrationTable.ContainsKey($name) -and $existingRegistrationTable.$name.DevelopmentDependency) {
|
||||
$DevelopmentDependency = $true
|
||||
}
|
||||
|
||||
$registration = New-NugetComponent -Name $name -Version $publicVersion -DevelopmentDependency:$DevelopmentDependency
|
||||
$RegistrationTable.Add($target, $registration)
|
||||
}
|
||||
if ($existingRegistrationTable.ContainsKey($name) -and $existingRegistrationTable.$name.DevelopmentDependency) {
|
||||
$DevelopmentDependency = $true
|
||||
}
|
||||
|
||||
$registration = New-NugetComponent -Name $name -Version $publicVersion -DevelopmentDependency:$DevelopmentDependency
|
||||
$RegistrationTable.Add($target, $registration)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user