diff --git a/DotnetRuntimeMetadata.json b/DotnetRuntimeMetadata.json index 84cdf2ce88f..418291f1a39 100644 --- a/DotnetRuntimeMetadata.json +++ b/DotnetRuntimeMetadata.json @@ -1,8 +1,11 @@ { "sdk": { - "channel": "release/5.0.1xx", - "packageVersionPattern": "5.0.0", - "sdkImageVersion": "5.0.100", - "nextChannel": "net5/rc2" + "channel": "release/6.0.1xx-preview1", + "packageVersionPattern": "6.0.0-preview.1", + "sdkImageVersion": "6.0.100", + "nextChannel": "net6/preview1" + }, + "internalfeed" : { + "url": null } } diff --git a/nuget.config b/nuget.config index 760e780c8ec..a8ed27bf99e 100644 --- a/nuget.config +++ b/nuget.config @@ -2,7 +2,7 @@ - + diff --git a/tools/UpdateDotnetRuntime.ps1 b/tools/UpdateDotnetRuntime.ps1 index 5bbe5e5faed..4bc9472bd3c 100644 --- a/tools/UpdateDotnetRuntime.ps1 +++ b/tools/UpdateDotnetRuntime.ps1 @@ -22,7 +22,7 @@ param ( [switch]$InteractiveAuth, [Parameter()] - [switch]$UseRTMFeed + [switch]$UseInternalFeed ) <# @@ -68,6 +68,7 @@ function Update-PackageVersion { "Microsoft.Management.Infrastructure" "Microsoft.PowerShell.Native" "Microsoft.NETCore.Windows.ApiSets" + "Microsoft.PowerShell.MarkdownRender" ) $packages = [System.Collections.Generic.Dictionary[[string], [PkgVer[]] ]]::new() @@ -97,7 +98,13 @@ function Update-PackageVersion { $versionPattern = (Get-Content "$PSScriptRoot/../DotnetRuntimeMetadata.json" | ConvertFrom-Json).sdk.packageVersionPattern - $source = if ($UseNuGetOrg) { 'nuget.org' } elseif ($UseRTMFeed) { 'dotnet5-rtm' } else { 'dotnet5' } + $source = if ($UseNuGetOrg) { 'nuget.org' } elseif ($UseInternalFeed) { 'dotnet-internal' } else { 'dotnet' } + + # Always add nuget.org as some packages are only found there. + $source = if ($source -ne 'nuget.org') { + @($source, "nuget.org") + } + $packages.GetEnumerator() | ForEach-Object { $pkgs = Find-Package -Name $_.Key -AllVersions -AllowPrereleaseVersions -Source $source @@ -105,13 +112,8 @@ function Update-PackageVersion { $version = $v.Version foreach ($p in $pkgs) { - if ($UseRTMFeed -and $p.Version -eq $versionPattern) { - if ([System.Management.Automation.SemanticVersion] ($version) -lt [System.Management.Automation.SemanticVersion] ($p.Version)) { - $v.NewVersion = $p.Version - break - } - } - elseif ($p.Version -like "$versionPattern*") { + # some packages are directly updated on nuget.org so need to check that too. + if ($p.Version -like "$versionPattern*" -or $p.Source -eq 'nuget.org') { if ([System.Management.Automation.SemanticVersion] ($version) -lt [System.Management.Automation.SemanticVersion] ($p.Version)) { $v.NewVersion = $p.Version break @@ -152,17 +154,21 @@ function Update-CsprojFile([string] $path, $values) { } function Get-DotnetUpdate { + $dotnetMetadataPath = "$PSScriptRoot/../DotnetRuntimeMetadata.json" + $metataJson = (Get-Content $dotnetMetadataPath -Raw | ConvertFrom-Json) + $nextChannel = $metataJson.sdk.nextChannel + $feedUrl = $metataJson.internalfeed.url + if ($SDKVersionOverride) { return @{ ShouldUpdate = $true NewVersion = $SDKVersionOverride Message = $null + FeedUrl = $feedUrl } } try { - $dotnetMetadataPath = "$PSScriptRoot/../DotnetRuntimeMetadata.json" - $nextChannel = (Get-Content $dotnetMetadataPath -Raw | ConvertFrom-Json).sdk.nextChannel $latestSDKversion = [System.Management.Automation.SemanticVersion] (Invoke-RestMethod -Uri "http://aka.ms/dotnet/$nextChannel/Sdk/productVersion.txt" -ErrorAction Stop | ForEach-Object { $_.Trim() }) $currentVersion = [System.Management.Automation.SemanticVersion] (( Get-Content -Path "$PSScriptRoot/../global.json" -Raw | ConvertFrom-Json).sdk.version) @@ -184,6 +190,7 @@ function Get-DotnetUpdate { ShouldUpdate = $shouldUpdate NewVersion = $newVersion Message = $Message + FeedUrl = $feedUrl } } @@ -210,32 +217,27 @@ if ($dotnetUpdate.ShouldUpdate) { Find-Dotnet - $feedname = if ($UseRTMFeed) { - 'dotnet5-rtm' - } elseif ($UseNuGetOrg) { - 'dotnet5' - } else { - 'dotnet-internal' - } + $feedname = if ($UseNuGetOrg) { 'nuget.org' } elseif ($UseInternalFeed) { 'dotnet-internal' } else { 'dotnet' } - $addDotnet5Source = (-not (Get-PackageSource -Name $feedname -ErrorAction SilentlyContinue)) + $addDotnetSource = (-not (Get-PackageSource -Name $feedname -ErrorAction SilentlyContinue)) - if (!$UseNuGetOrg -and ($addDotnet5Source -or $addDotnet5InternalSource)) { - $nugetFileSources = ([xml](Get-Content .\nuget.config -Raw)).Configuration.packagesources.add + if (!$UseNuGetOrg -and $addDotnetSource) { + $nugetFileContent = Get-Content "$PSScriptRoot/../nuget.config" -Raw + $nugetFileSources = ([xml]($nugetFileContent)).Configuration.packagesources.add - if ($addDotnet5Source -and $feedname -ne 'dotnet-internal') { - $dotnet5Feed = $nugetFileSources | Where-Object { $_.Key -eq $feedname } | Select-Object -ExpandProperty Value - Register-PackageSource -Name $feedname -Location $dotnet5Feed -ProviderName NuGet + if ($feedname -ne 'dotnet-internal') { + $dotnetFeed = $nugetFileSources | Where-Object { $_.Key -eq $feedname } | Select-Object -ExpandProperty Value + Register-PackageSource -Name $feedname -Location $dotnetFeed -ProviderName NuGet Write-Verbose -Message "Register new package source $feedname" -verbose } - if ($addDotnet5Source -and $InteractiveAuth -and $feedname -eq 'dotnet-internal') { + if ($feedname -eq 'dotnet-internal') { # This NuGet feed is for internal to Microsoft use only. - $dotnet5InternalFeed = 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal/nuget/v3/index.json' - $updatedNugetFile = (Get-Content .\nuget.config -Raw) -replace "", " `r`n " - $updatedNugetFile | Out-File .\nuget.config -Force - Register-PackageSource -Name 'dotnet5-internal' -Location $dotnet5InternalFeed -ProviderName NuGet - Write-Verbose -Message "Register new package source 'dotnet5-internal'" -verbose + $dotnetInternalFeed = $dotnetMetadataJson.internalfeed.url + $updatedNugetFile = $nugetFileContent -replace "", " `r`n " + $updatedNugetFile | Out-File "$PSScriptRoot/../nuget.config" -Force + Register-PackageSource -Name 'dotnet-internal' -Location $dotnetInternalFeed -ProviderName NuGet + Write-Verbose -Message "Register new package source 'dotnet-internal'" -verbose } }