@@ -22,7 +22,7 @@ param ( |
22 | 22 | [switch]$InteractiveAuth, |
23 | 23 |
|
24 | 24 | [Parameter()] |
25 | | - [switch]$UseRTMFeed |
| 25 | + [switch]$UseInternalFeed |
26 | 26 | ) |
27 | 27 |
|
28 | 28 | <# |
@@ -68,6 +68,7 @@ function Update-PackageVersion { |
68 | 68 | "Microsoft.Management.Infrastructure" |
69 | 69 | "Microsoft.PowerShell.Native" |
70 | 70 | "Microsoft.NETCore.Windows.ApiSets" |
| 71 | + "Microsoft.PowerShell.MarkdownRender" |
71 | 72 | ) |
72 | 73 |
|
73 | 74 | $packages = [System.Collections.Generic.Dictionary[[string], [PkgVer[]] ]]::new() |
@@ -97,21 +98,22 @@ function Update-PackageVersion { |
97 | 98 |
|
98 | 99 | $versionPattern = (Get-Content "$PSScriptRoot/../DotnetRuntimeMetadata.json" | ConvertFrom-Json).sdk.packageVersionPattern |
99 | 100 |
|
100 | | - $source = if ($UseNuGetOrg) { 'nuget.org' } elseif ($UseRTMFeed) { 'dotnet5-rtm' } else { 'dotnet5' } |
| 101 | + $source = if ($UseNuGetOrg) { 'nuget.org' } elseif ($UseInternalFeed) { 'dotnet-internal' } else { 'dotnet' } |
| 102 | + |
| 103 | + # Always add nuget.org as some packages are only found there. |
| 104 | + $source = if ($source -ne 'nuget.org') { |
| 105 | + @($source, "nuget.org") |
| 106 | + } |
| 107 | + |
101 | 108 | $packages.GetEnumerator() | ForEach-Object { |
102 | 109 | $pkgs = Find-Package -Name $_.Key -AllVersions -AllowPrereleaseVersions -Source $source |
103 | 110 |
|
104 | 111 | foreach ($v in $_.Value) { |
105 | 112 | $version = $v.Version |
106 | 113 |
|
107 | 114 | foreach ($p in $pkgs) { |
108 | | - if ($UseRTMFeed -and $p.Version -eq $versionPattern) { |
109 | | - if ([System.Management.Automation.SemanticVersion] ($version) -lt [System.Management.Automation.SemanticVersion] ($p.Version)) { |
110 | | - $v.NewVersion = $p.Version |
111 | | - break |
112 | | - } |
113 | | - } |
114 | | - elseif ($p.Version -like "$versionPattern*") { |
| 115 | + # some packages are directly updated on nuget.org so need to check that too. |
| 116 | + if ($p.Version -like "$versionPattern*" -or $p.Source -eq 'nuget.org') { |
115 | 117 | if ([System.Management.Automation.SemanticVersion] ($version) -lt [System.Management.Automation.SemanticVersion] ($p.Version)) { |
116 | 118 | $v.NewVersion = $p.Version |
117 | 119 | break |
@@ -152,17 +154,21 @@ function Update-CsprojFile([string] $path, $values) { |
152 | 154 | } |
153 | 155 |
|
154 | 156 | function Get-DotnetUpdate { |
| 157 | + $dotnetMetadataPath = "$PSScriptRoot/../DotnetRuntimeMetadata.json" |
| 158 | + $metataJson = (Get-Content $dotnetMetadataPath -Raw | ConvertFrom-Json) |
| 159 | + $nextChannel = $metataJson.sdk.nextChannel |
| 160 | + $feedUrl = $metataJson.internalfeed.url |
| 161 | + |
155 | 162 | if ($SDKVersionOverride) { |
156 | 163 | return @{ |
157 | 164 | ShouldUpdate = $true |
158 | 165 | NewVersion = $SDKVersionOverride |
159 | 166 | Message = $null |
| 167 | + FeedUrl = $feedUrl |
160 | 168 | } |
161 | 169 | } |
162 | 170 |
|
163 | 171 | try { |
164 | | - $dotnetMetadataPath = "$PSScriptRoot/../DotnetRuntimeMetadata.json" |
165 | | - $nextChannel = (Get-Content $dotnetMetadataPath -Raw | ConvertFrom-Json).sdk.nextChannel |
166 | 172 | $latestSDKversion = [System.Management.Automation.SemanticVersion] (Invoke-RestMethod -Uri "http://aka.ms/dotnet/$nextChannel/Sdk/productVersion.txt" -ErrorAction Stop | ForEach-Object { $_.Trim() }) |
167 | 173 | $currentVersion = [System.Management.Automation.SemanticVersion] (( Get-Content -Path "$PSScriptRoot/../global.json" -Raw | ConvertFrom-Json).sdk.version) |
168 | 174 |
|
@@ -184,6 +190,7 @@ function Get-DotnetUpdate { |
184 | 190 | ShouldUpdate = $shouldUpdate |
185 | 191 | NewVersion = $newVersion |
186 | 192 | Message = $Message |
| 193 | + FeedUrl = $feedUrl |
187 | 194 | } |
188 | 195 | } |
189 | 196 |
|
@@ -210,32 +217,27 @@ if ($dotnetUpdate.ShouldUpdate) { |
210 | 217 |
|
211 | 218 | Find-Dotnet |
212 | 219 |
|
213 | | - $feedname = if ($UseRTMFeed) { |
214 | | - 'dotnet5-rtm' |
215 | | - } elseif ($UseNuGetOrg) { |
216 | | - 'dotnet5' |
217 | | - } else { |
218 | | - 'dotnet-internal' |
219 | | - } |
| 220 | + $feedname = if ($UseNuGetOrg) { 'nuget.org' } elseif ($UseInternalFeed) { 'dotnet-internal' } else { 'dotnet' } |
220 | 221 |
|
221 | | - $addDotnet5Source = (-not (Get-PackageSource -Name $feedname -ErrorAction SilentlyContinue)) |
| 222 | + $addDotnetSource = (-not (Get-PackageSource -Name $feedname -ErrorAction SilentlyContinue)) |
222 | 223 |
|
223 | | - if (!$UseNuGetOrg -and ($addDotnet5Source -or $addDotnet5InternalSource)) { |
224 | | - $nugetFileSources = ([xml](Get-Content .\nuget.config -Raw)).Configuration.packagesources.add |
| 224 | + if (!$UseNuGetOrg -and $addDotnetSource) { |
| 225 | + $nugetFileContent = Get-Content "$PSScriptRoot/../nuget.config" -Raw |
| 226 | + $nugetFileSources = ([xml]($nugetFileContent)).Configuration.packagesources.add |
225 | 227 |
|
226 | | - if ($addDotnet5Source -and $feedname -ne 'dotnet-internal') { |
227 | | - $dotnet5Feed = $nugetFileSources | Where-Object { $_.Key -eq $feedname } | Select-Object -ExpandProperty Value |
228 | | - Register-PackageSource -Name $feedname -Location $dotnet5Feed -ProviderName NuGet |
| 228 | + if ($feedname -ne 'dotnet-internal') { |
| 229 | + $dotnetFeed = $nugetFileSources | Where-Object { $_.Key -eq $feedname } | Select-Object -ExpandProperty Value |
| 230 | + Register-PackageSource -Name $feedname -Location $dotnetFeed -ProviderName NuGet |
229 | 231 | Write-Verbose -Message "Register new package source $feedname" -verbose |
230 | 232 | } |
231 | 233 |
|
232 | | - if ($addDotnet5Source -and $InteractiveAuth -and $feedname -eq 'dotnet-internal') { |
| 234 | + if ($feedname -eq 'dotnet-internal') { |
233 | 235 | # This NuGet feed is for internal to Microsoft use only. |
234 | | - $dotnet5InternalFeed = 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal/nuget/v3/index.json' |
235 | | - $updatedNugetFile = (Get-Content .\nuget.config -Raw) -replace "</packageSources>", " <add key=`"dotnet5-internal`" value=`"$dotnet5InternalFeed`" />`r`n </packageSources>" |
236 | | - $updatedNugetFile | Out-File .\nuget.config -Force |
237 | | - Register-PackageSource -Name 'dotnet5-internal' -Location $dotnet5InternalFeed -ProviderName NuGet |
238 | | - Write-Verbose -Message "Register new package source 'dotnet5-internal'" -verbose |
| 236 | + $dotnetInternalFeed = $dotnetMetadataJson.internalfeed.url |
| 237 | + $updatedNugetFile = $nugetFileContent -replace "</packageSources>", " <add key=`"dotnet-internal`" value=`"$dotnetInternalFeed`" />`r`n </packageSources>" |
| 238 | + $updatedNugetFile | Out-File "$PSScriptRoot/../nuget.config" -Force |
| 239 | + Register-PackageSource -Name 'dotnet-internal' -Location $dotnetInternalFeed -ProviderName NuGet |
| 240 | + Write-Verbose -Message "Register new package source 'dotnet-internal'" -verbose |
239 | 241 | } |
240 | 242 | } |
241 | 243 |
|
|