Skip to content

Commit 2925f3c

Browse files
author
Dan Seefeldt
committed
Update legacy myget feeds
1 parent 8482f70 commit 2925f3c

File tree

5 files changed

+96
-4
lines changed

5 files changed

+96
-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: 40 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,45 @@
139140
SourcePath="$(ExtraRestoreSourcePath)"
140141
Condition="'$(ExtraRestoreSourcePath)' != ''" />
141142

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

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: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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. Each item must have metadata NewFeed
26+
/// that specifies the replacement feed.
27+
/// </summary>
28+
[Required]
29+
public ITaskItem[] FeedMapping { get; set; }
30+
31+
public override bool Execute()
32+
{
33+
string fileContents = File.ReadAllText(InputFile);
34+
bool updated = false;
35+
36+
foreach (var feed in FeedMapping)
37+
{
38+
string oldFeed = feed.ItemSpec;
39+
string newFeed = feed.GetMetadata("NewFeed");
40+
41+
if (fileContents.Contains(oldFeed))
42+
{
43+
fileContents = fileContents.Replace(oldFeed, newFeed);
44+
updated = true;
45+
}
46+
}
47+
48+
if (updated) File.WriteAllText(InputFile, fileContents);
49+
50+
return true;
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)