mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
[release/v7.5] Make Component Manifest Updater use neutral target in addition to RID target (#25325)
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
This commit is contained in:
co-authored by
Travis Plunk
parent
dc5833b71a
commit
7ff28d3738
@@ -203,28 +203,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"
|
||||
@@ -241,6 +247,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
|
||||
@@ -250,27 +257,51 @@ function Get-CGRegistrations {
|
||||
Get-PSDrive -Name $folder -ErrorAction Ignore | Remove-PSDrive
|
||||
}
|
||||
|
||||
# Name to skip for TPN generation
|
||||
$skipNames = @(
|
||||
"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]
|
||||
$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
|
||||
}
|
||||
if ($existingRegistrationTable.ContainsKey($name) -and $existingRegistrationTable.$name.DevelopmentDependency) {
|
||||
$DevelopmentDependency = $true
|
||||
}
|
||||
if ($name -in $skipNames) {
|
||||
Write-Verbose "Skipping $name..."
|
||||
|
||||
$registration = New-NugetComponent -Name $name -Version $publicVersion -DevelopmentDependency:$DevelopmentDependency
|
||||
$RegistrationTable.Add($target, $registration)
|
||||
} 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
|
||||
}
|
||||
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