Skip to content

Commit 2c6dc9b

Browse files
dseefeldDan Seefeldt
andauthored
[release/3.1] Replace legacy MyGet feeds (#1974)
* Update legacy myget feeds * Exclude Arcade from package cache cleanup Co-authored-by: Dan Seefeldt <dseefeld@localhost.localdomain>
1 parent 1ad840f commit 2c6dc9b

File tree

8 files changed

+128
-12
lines changed

8 files changed

+128
-12
lines changed

NuGet.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<add key="darc-pub-dotnet-aspnetcore-e318707" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-aspnetcore-e3187077/nuget/v3/index.json" />
1313
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
1414
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
15-
<add key="nuget-build" value="https://dotnet.myget.org/F/nuget-build/api/v3/index.json" />
15+
<add key="nuget-build" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/nuget-build/nuget/v3/index.json" />
1616
<add key="arcade" value="https://dotnetfeed.blob.core.windows.net/dotnet-tools-internal/index.json" />
1717
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
1818
</packageSources>

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Microsoft.Build.CentralPackageVersions": "2.0.1",
77
"Microsoft.Build.Traversal": "2.0.2",
88
"Microsoft.NET.Sdk.IL": "3.0.0-preview-27107-01",
9-
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19359.6",
9+
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20113.5",
1010
"Yarn.MSBuild": "1.15.2"
1111
}
1212
}

repos/Directory.Build.targets

Lines changed: 66 additions & 1 deletion
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" />
@@ -120,6 +121,64 @@
120121
SourceName="source-built"
121122
SourcePath="$(SourceBuiltPackagesPath)" />
122123

124+
<!-- Update NuGet.Config files that have deprecated myget feeds -->
125+
<ItemGroup>
126+
<LegacyFeedMapping
127+
Include="https://dotnet.myget.org/F/nuget-build/api/v3/index.json"
128+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/nuget-build/nuget/v3/index.json" />
129+
<LegacyFeedMapping
130+
Include="https://www.myget.org/F/nugetbuild/api/v3/index.json"
131+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/nuget-build/nuget/v3/index.json" />
132+
<LegacyFeedMapping
133+
Include="https://dotnet.myget.org/F/dotnet-corefxlab/api/v3/index.json"
134+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json" />
135+
<LegacyFeedMapping
136+
Include="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"
137+
NewFeed="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
138+
<LegacyFeedMapping
139+
Include="https://dotnet.myget.org/F/system-commandline/api/v3/index.json"
140+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
141+
<LegacyFeedMapping
142+
Include="https://dotnet.myget.org/F/vstest/api/v3/index.json"
143+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
144+
<LegacyFeedMapping
145+
Include="https://dotnet.myget.org/F/mstestv2/auth/1e768268-8c95-4e7e-9fd2-0eb1b1b69b18/api/v3/index.json"
146+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
147+
<LegacyFeedMapping
148+
Include="https://dotnet.myget.org/F/roslyn/api/v3/index.json"
149+
NewFeed="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json" />
150+
<LegacyFeedMapping
151+
Include="https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json"
152+
NewFeed="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json" />
153+
<LegacyFeedMapping
154+
Include="https://dotnet.myget.org/F/roslyn-analyzers/api/v3/index.json"
155+
NewFeed="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json" />
156+
<LegacyFeedMapping
157+
Include="https://dotnet.myget.org/F/roslyn-master-nightly/api/v3/index.json"
158+
NewFeed="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json" />
159+
<LegacyFeedMapping
160+
Include="https://dotnet.myget.org/F/symreader-converter/api/v3/index.json"
161+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
162+
<LegacyFeedMapping
163+
Include="https://dotnet.myget.org/F/interactive-window/api/v3/index.json"
164+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
165+
<LegacyFeedMapping
166+
Include="https://dotnet.myget.org/F/mstestv2/api/v3/index.json"
167+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
168+
<LegacyFeedMapping
169+
Include="https://dotnet.myget.org/F/vsunittesting/api/v3/index.json"
170+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
171+
<LegacyFeedMapping
172+
Include="https://dotnet.myget.org/F/msbuild/api/v3/index.json"
173+
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
174+
<LegacyFeedMapping
175+
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+
123182
<!--
124183
The internal transport feed is dynamically added by Arcade by a script called directly in the
125184
official pipeline, so in some cases we need to do the same here.
@@ -353,7 +412,13 @@
353412
Inputs="$(MSBuildProjectFullPath)"
354413
Outputs="$(RepoCompletedSemaphorePath)RemoveBuiltPackagesFromCache.complete">
355414

356-
<ReadNuGetPackageInfos PackagePaths="@(_BuiltPackages)">
415+
<ItemGroup>
416+
<!-- Excluding Arcade here will keep it in the cache, because that's where we're running from.
417+
Subsequent projects will get Arcade from Tools/source-built. -->
418+
<PackagePaths Include="@(_BuiltPackages)" Exclude="$(PackagesOutput)/Microsoft.DotNet.Arcade.Sdk.*.nupkg" />
419+
</ItemGroup>
420+
421+
<ReadNuGetPackageInfos PackagePaths="@(PackagePaths)">
357422
<Output TaskParameter="PackageInfoItems" ItemName="_BuiltPackageInfos" />
358423
</ReadNuGetPackageInfos>
359424

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>

repos/msbuild.proj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@
3939
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://api.nuget.org/v3/index.json</EnvironmentRestoreSources>
4040
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnetfeed.blob.core.windows.net/dotnet-core/index.json</EnvironmentRestoreSources>
4141
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnetfeed.blob.core.windows.net/dotnet-tools-internal/index.json</EnvironmentRestoreSources>
42-
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json</EnvironmentRestoreSources>
43-
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnet.myget.org/F/nuget-build/api/v3/index.json</EnvironmentRestoreSources>
44-
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnet.myget.org/F/roslyn/api/v3/index.json</EnvironmentRestoreSources>
45-
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnet.myget.org/F/roslyn-tools/api/v3/index.json</EnvironmentRestoreSources>
42+
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://pkgs.dev.azure.com/dnceng/public/_packaging/myget-legacy/nuget/v3/index.json</EnvironmentRestoreSources>
43+
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://pkgs.dev.azure.com/dnceng/public/_packaging/nuget-build/nuget/v3/index.json</EnvironmentRestoreSources>
44+
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json</EnvironmentRestoreSources>
4645
</PropertyGroup>
4746

4847
<ItemGroup>

repos/websdk.proj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://api.nuget.org/v3/index.json</EnvironmentRestoreSources>
2727
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json</EnvironmentRestoreSources>
2828
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnetfeed.blob.core.windows.net/aspnet-blazor/index.json</EnvironmentRestoreSources>
29-
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json</EnvironmentRestoreSources>
30-
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json</EnvironmentRestoreSources>
29+
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json</EnvironmentRestoreSources>
3130

3231
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
3332
</PropertyGroup>

smoke-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ function setupDevCerts() {
281281
echo "Setting up dotnet-dev-certs $devCertsVersion to generate dev certificate" | tee -a "$logFile"
282282
(
283283
set -x
284-
"$dotnetDir/dotnet" tool install -g dotnet-dev-certs --version "$devCertsVersion" --add-source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
284+
"$dotnetDir/dotnet" tool install -g dotnet-dev-certs --version "$devCertsVersion" --add-source https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
285285
export DOTNET_ROOT="$dotnetDir"
286286
"$testingHome/.dotnet/tools/dotnet-dev-certs" https
287287
) >> "$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)