Add a way to use only NuGet feed sources (#24528)

* Update build.psm1

* update default feeds

* fix issue with cgmanifest having duplicate existing entries

* update pattern
This commit is contained in:
Travis Plunk 2024-10-31 13:13:04 -07:00 committed by GitHub
parent 3f51dfa603
commit adac4c7117
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 11 deletions

View File

@ -740,7 +740,7 @@ function Switch-PSNugetConfig {
param(
[Parameter(Mandatory = $true, ParameterSetName = 'user')]
[Parameter(Mandatory = $true, ParameterSetName = 'nouser')]
[ValidateSet('Public', 'Private')]
[ValidateSet('Public', 'Private', 'NuGetOnly')]
[string] $Source,
[Parameter(Mandatory = $true, ParameterSetName = 'user')]
@ -760,16 +760,19 @@ function Switch-PSNugetConfig {
}
}
if ( $Source -eq 'Public') {
$dotnetSdk = [NugetPackageSource] @{Url = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v2'; Name = 'dotnet' }
$gallery = [NugetPackageSource] @{Url = 'https://www.powershellgallery.com/api/v2/'; Name = 'psgallery' }
$nugetorg = [NugetPackageSource] @{Url = 'https://api.nuget.org/v3/index.json'; Name = 'nuget.org' }
if ( $Source -eq 'Public') {
New-NugetConfigFile -NugetPackageSource $nugetorg, $dotnetSdk -Destination "$PSScriptRoot/" @extraParams
New-NugetConfigFile -NugetPackageSource $gallery -Destination "$PSScriptRoot/src/Modules/" @extraParams
New-NugetConfigFile -NugetPackageSource $gallery -Destination "$PSScriptRoot/test/tools/Modules/" @extraParams
} elseif ( $Source -eq 'NuGetOnly') {
New-NugetConfigFile -NugetPackageSource $nugetorg -Destination "$PSScriptRoot/" @extraParams
New-NugetConfigFile -NugetPackageSource $gallery -Destination "$PSScriptRoot/src/Modules/" @extraParams
New-NugetConfigFile -NugetPackageSource $gallery -Destination "$PSScriptRoot/test/tools/Modules/" @extraParams
} elseif ( $Source -eq 'Private') {
$powerShellPackages = [NugetPackageSource] @{Url = 'https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/PowerShell-7-5-preview-test-2/nuget/v3/index.json'; Name = 'powershell' }
$powerShellPackages = [NugetPackageSource] @{Url = 'https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/PowerShell/nuget/v3/index.json'; Name = 'powershell' }
New-NugetConfigFile -NugetPackageSource $powerShellPackages -Destination "$PSScriptRoot/" @extraParams
New-NugetConfigFile -NugetPackageSource $powerShellPackages -Destination "$PSScriptRoot/src/Modules/" @extraParams

View File

@ -2,7 +2,7 @@
<configuration>
<packageSources>
<clear />
<add key="powershell" value="https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/PowerShell-7-5-preview-test-2/nuget/v3/index.json" />
<add key="powershell" value="https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/PowerShell/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />

View File

@ -2,7 +2,7 @@
<configuration>
<packageSources>
<clear />
<add key="powershell" value="https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/PowerShell-7-5-preview-test-2/nuget/v3/index.json" />
<add key="powershell" value="https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/PowerShell/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />

View File

@ -2,7 +2,7 @@
<configuration>
<packageSources>
<clear />
<add key="powershell" value="https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/PowerShell-7-5-preview-test-2/nuget/v3/index.json" />
<add key="powershell" value="https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/PowerShell/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />

View File

@ -26,9 +26,11 @@ $existingRegistrationsJson.Registrations | ForEach-Object {
$registration = [Registration]$_
if ($registration.Component) {
$name = $registration.Component.Name()
if (!$existingRegistrationTable.ContainsKey($name)) {
$existingRegistrationTable.Add($name, $registration)
}
}
}
Class Registration {
[Component]$Component
@ -103,7 +105,7 @@ function ConvertTo-SemVer {
So, I'm making the logic work for that scenario by
thorwing away any part that doesn't match non-pre-release semver portion
#>
$null = $Version -match '^(\d+\.\d+\.\d+)).*'
$null = $Version -match '^(\d+\.\d+\.\d+).*'
$desiredVersion = $matches[1]
}