Skip to content

Commit 1f62cf5

Browse files
committed
Port infra from release/3.1 to setup internal feeds correctly
1 parent b609836 commit 1f62cf5

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

repos/Directory.Build.targets

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@
113113
<NuGetConfigFiles Include="$(NuGetConfigFile)" />
114114
</ItemGroup>
115115

116-
<RemoveInternetSourcesFromNuGetConfig NuGetConfigFile="%(NuGetConfigFiles.Identity)"
117-
OfflineBuild="$(OfflineBuild)" />
116+
<RemoveInternetSourcesFromNuGetConfig
117+
NuGetConfigFile="%(NuGetConfigFiles.Identity)"
118+
OfflineBuild="$(OfflineBuild)"
119+
KeepFeedPrefixes="@(KeepFeedPrefixes)" />
118120

119121
<AddSourceToNuGetConfig NuGetConfigFile="%(NuGetConfigFiles.Identity)"
120122
SourceName="prebuilt"
@@ -140,6 +142,18 @@
140142
SourcePath="$(ExtraRestoreSourcePath)"
141143
Condition="'$(ExtraRestoreSourcePath)' != ''" />
142144

145+
<!--
146+
The internal transport feed is dynamically added by Arcade by a script called directly in the
147+
official pipeline, so in some cases we need to do the same here.
148+
-->
149+
<AddSourceToNuGetConfig
150+
Condition="
151+
'$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)' != '' and
152+
'$(SetUpInternalTransportFeed)' == 'true'"
153+
NuGetConfigFile="%(NuGetConfigFiles.Identity)"
154+
SourceName="dotnet5-internal-transport"
155+
SourcePath="https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v3/index.json" />
156+
143157
<!-- Update NuGet.Config files that have deprecated myget feeds -->
144158
<ItemGroup>
145159
<LegacyFeedMapping

repos/installer.proj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@
6363
<!-- This project builds zips, not NuGet packages. -->
6464
<SkipEnsurePackagesCreated>true</SkipEnsurePackagesCreated>
6565
<NuGetConfigFile>$(ProjectDirectory)/NuGet.config</NuGetConfigFile>
66+
67+
<!-- This repo uses text-only template packages from the internal transport feed. -->
68+
<SetUpInternalTransportFeed>true</SetUpInternalTransportFeed>
6669
</PropertyGroup>
6770

6871
<ItemGroup>
@@ -89,6 +92,15 @@
8992
<RepositoryReference Include="xliff-tasks" />
9093
</ItemGroup>
9194

95+
<!--
96+
If we have authentication, keep the templating internal feed (if one exists) to acquire the
97+
text-only prebuilt. The source-build repo as a whole should depend on the same internal feed as
98+
this repo does, so authentication should already be set up in the global endpoints json.
99+
-->
100+
<ItemGroup Condition="'$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)' != ''">
101+
<KeepFeedPrefixes Include="darc-int-dotnet-aspnetcore-" />
102+
</ItemGroup>
103+
92104
<ItemGroup>
93105
<EnvironmentVariables Include="CLIBUILD_SKIP_TESTS=true" />
94106

tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.XPlat/RemoveInternetSourcesFromNuGetConfig.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ public class RemoveInternetSourcesFromNuGetConfig : Task
2727
/// </summary>
2828
public bool OfflineBuild { get; set; }
2929

30+
/// <summary>
31+
/// A list of prefix strings that make the task keep a package source unconditionally. For
32+
/// example, a source named 'darc-pub-dotnet-aspnetcore-e81033e' will be kept if the prefix
33+
/// 'darc-pub-dotnet-aspnetcore-' is in this list.
34+
/// </summary>
35+
public string[] KeepFeedPrefixes { get; set; }
36+
3037
public override bool Execute()
3138
{
3239
XDocument d = XDocument.Load(NuGetConfigFile);
@@ -36,6 +43,14 @@ public override bool Execute()
3643
{
3744
if (e.Name == "add")
3845
{
46+
string feedName = e.Attribute("key").Value;
47+
if (KeepFeedPrefixes
48+
?.Any(prefix => feedName.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
49+
== true)
50+
{
51+
return true;
52+
}
53+
3954
string feedUrl = e.Attribute("value").Value;
4055
if (OfflineBuild)
4156
{

0 commit comments

Comments
 (0)