Skip to content

Commit eea00e5

Browse files
dseefeldDan Seefeldt
andauthored
[master] Replace legacy MyGet feeds (#1972)
* Update legacy myget feeds * Fix spacing issue * Update based on review comments Co-authored-by: Dan Seefeldt <[email protected]>
1 parent c70697a commit eea00e5

File tree

5 files changed

+113
-4
lines changed

5 files changed

+113
-4
lines changed

NuGet.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<add key="darc-pub-dotnet-aspnetcore-371a26f" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-aspnetcore-371a26f0/nuget/v3/index.json" />
1010
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
1111
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
12-
<add key="nuget-build" value="https://dotnet.myget.org/F/nuget-build/api/v3/index.json" />
12+
<add key="nuget-build" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/nuget-build/nuget/v3/index.json" />
1313
<add key="dotnet5" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
1414
<add key="dotnet5-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json" />
1515
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />

repos/Directory.Build.targets

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="GetSourceBuiltNupkgCacheConflicts" />
1010
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReadNuGetPackageInfos" />
1111
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="RemoveInternetSourcesFromNuGetConfig" />
12+
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceFeedsInNuGetConfig" />
1213
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="UpdateJson" />
1314
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ValidateUsageAgainstBaseline" />
1415
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteBuildOutputProps" />
@@ -139,6 +140,61 @@
139140
SourcePath="$(ExtraRestoreSourcePath)"
140141
Condition="'$(ExtraRestoreSourcePath)' != ''" />
141142

143+
<!-- Update NuGet.Config files that have deprecated myget feeds -->
144+
<ItemGroup>
145+
<LegacyFeedMapping
146+
Include="https://dotnet.myget.org/F/nuget-build/api/v3/index.json"
147+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/nuget-build/nuget/v3/index.json" />
148+
<LegacyFeedMapping
149+
Include="https://www.myget.org/F/nugetbuild/api/v3/index.json"
150+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/nuget-build/nuget/v3/index.json" />
151+
<LegacyFeedMapping
152+
Include="https://dotnet.myget.org/F/dotnet-corefxlab/api/v3/index.json"
153+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json" />
154+
<LegacyFeedMapping
155+
Include="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"
156+
NewFeed="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
157+
<LegacyFeedMapping
158+
Include="https://dotnet.myget.org/F/vstest/api/v3/index.json"
159+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
160+
<LegacyFeedMapping
161+
Include="https://dotnet.myget.org/F/mstestv2/auth/1e768268-8c95-4e7e-9fd2-0eb1b1b69b18/api/v3/index.json"
162+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
163+
<LegacyFeedMapping
164+
Include="https://dotnet.myget.org/F/roslyn/api/v3/index.json"
165+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
166+
<LegacyFeedMapping
167+
Include="https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json"
168+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
169+
<LegacyFeedMapping
170+
Include="https://dotnet.myget.org/F/roslyn-analyzers/api/v3/index.json"
171+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
172+
<LegacyFeedMapping
173+
Include="https://dotnet.myget.org/F/roslyn-master-nightly/api/v3/index.json"
174+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
175+
<LegacyFeedMapping
176+
Include="https://dotnet.myget.org/F/symreader-converter/api/v3/index.json"
177+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
178+
<LegacyFeedMapping
179+
Include="https://dotnet.myget.org/F/interactive-window/api/v3/index.json"
180+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
181+
<LegacyFeedMapping
182+
Include="https://dotnet.myget.org/F/mstestv2/api/v3/index.json"
183+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
184+
<LegacyFeedMapping
185+
Include="https://dotnet.myget.org/F/vsunittesting/api/v3/index.json"
186+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
187+
<LegacyFeedMapping
188+
Include="https://dotnet.myget.org/F/msbuild/api/v3/index.json"
189+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
190+
<LegacyFeedMapping
191+
Include="https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json"
192+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/myget-legacy/nuget/v3/index.json" />
193+
</ItemGroup>
194+
195+
<ReplaceFeedsInNugetConfig InputFile="%(NuGetConfigFiles.Identity)"
196+
FeedMapping="@(LegacyFeedMapping)" />
197+
142198
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)UpdateNuGetConfig.complete" Overwrite="true" />
143199
</Target>
144200

repos/aspnetcore.proj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json</EnvironmentRestoreSources>
4242
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnetfeed.blob.core.windows.net/aspnet-blazor/index.json</EnvironmentRestoreSources>
4343
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnetfeed.blob.core.windows.net/dotnet-core/index.json</EnvironmentRestoreSources>
44-
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json</EnvironmentRestoreSources>
45-
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json</EnvironmentRestoreSources>
44+
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json</EnvironmentRestoreSources>
4645
</PropertyGroup>
4746

4847
<ItemGroup>

smoke-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function setupDevCerts() {
253253
echo "Setting up dotnet-dev-certs $devCertsVersion to generate dev certificate" | tee -a "$logFile"
254254
(
255255
set -x
256-
"$dotnetDir/dotnet" tool install -g dotnet-dev-certs --version "$devCertsVersion" --add-source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
256+
"$dotnetDir/dotnet" tool install -g dotnet-dev-certs --version "$devCertsVersion" --add-source https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
257257
export DOTNET_ROOT="$dotnetDir"
258258
"$testingHome/.dotnet/tools/dotnet-dev-certs" https
259259
) >> "$logFile" 2>&1
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System;
6+
using System.IO;
7+
using Microsoft.Build.Framework;
8+
using Microsoft.Build.Utilities;
9+
10+
namespace Microsoft.DotNet.Build.Tasks
11+
{
12+
/// <summary>
13+
/// Replaces feeds in a NuGet.Config file given a mapping
14+
/// of old feeds to new feeds.
15+
/// </summary>
16+
public class ReplaceFeedsInNuGetConfig : Task
17+
{
18+
/// <summary>
19+
/// The NuGet.Config file in which to replace feeds.
20+
/// </summary>
21+
[Required]
22+
public string InputFile { get; set; }
23+
24+
/// <summary>
25+
/// An item group of feeds to update.
26+
/// %(Identity): The feed URL to find in the NuGet.Config.
27+
/// %(NewFeed): The feed URL to replace %(Identity) with.
28+
/// </summary>
29+
[Required]
30+
public ITaskItem[] FeedMapping { get; set; }
31+
32+
public override bool Execute()
33+
{
34+
string fileContents = File.ReadAllText(InputFile);
35+
bool updated = false;
36+
37+
foreach (var feed in FeedMapping)
38+
{
39+
string oldFeed = feed.ItemSpec;
40+
string newFeed = feed.GetMetadata("NewFeed");
41+
42+
if (fileContents.Contains(oldFeed))
43+
{
44+
fileContents = fileContents.Replace(oldFeed, newFeed);
45+
updated = true;
46+
}
47+
}
48+
49+
if (updated) File.WriteAllText(InputFile, fileContents);
50+
51+
return true;
52+
}
53+
}
54+
}

0 commit comments

Comments
 (0)