mirror of
https://github.com/PowerShell/PowerShell.git
synced 2024-11-26 19:34:22 +08:00
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:
parent
3f51dfa603
commit
adac4c7117
11
build.psm1
11
build.psm1
@ -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
|
||||
|
@ -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 />
|
||||
|
@ -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 />
|
||||
|
@ -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 />
|
||||
|
@ -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]
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user