Skip to content

Commit 259d712

Browse files
committed
Update source-build-externals and package source mapping logic
1 parent 0aa846d commit 259d712

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

eng/Version.Details.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
</Dependency>
187187
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-externals" Version="7.0.0-alpha.1.22402.1">
188188
<Uri>https://github.com/MichaelSimons/source-build-externals</Uri>
189-
<Sha>97d5463ffc198019d4b68f18d3c0a4e0976782bb</Sha>
189+
<Sha>85d7e996e497861648ffbfd0e929b2b627ce7f46</Sha>
190190
<SourceBuild RepoName="source-build-externals" ManagedOnly="true" />
191191
</Dependency>
192192
<Dependency Name="Microsoft.SourceBuild.Intermediate.symreader" Version="1.4.0-beta2-21475-02">

src/SourceBuild/tarball/content/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.XPlat/UpdateNuGetConfigPackageSourcesMappings.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ public override bool Execute()
4747
}
4848

4949
// Union all package sources to get the distinct list. These will get added to the source-build sources.
50-
IEnumerable<string> packagePatterns = pkgSrcMappingElement.Descendants()
50+
string[] packagePatterns = pkgSrcMappingElement.Descendants()
5151
.Where(e => e.Name == "packageSource")
5252
.SelectMany(e => e.Descendants().Where(e => e.Name == "package"))
5353
.Select(e => e.Attribute("pattern").Value)
54-
.Distinct();
54+
.Distinct()
55+
.ToArray();
5556

5657
if (!BuildWithOnlineSources)
5758
{
@@ -60,6 +61,11 @@ public override bool Execute()
6061
}
6162

6263
XElement pkgSrcMappingClearElement = pkgSrcMappingElement.Descendants().FirstOrDefault(e => e.Name == "clear");
64+
if (pkgSrcMappingClearElement == null)
65+
{
66+
pkgSrcMappingClearElement = new XElement("clear");
67+
pkgSrcMappingElement.AddFirst(pkgSrcMappingClearElement);
68+
}
6369

6470
foreach (string packageSource in SourceBuildSources)
6571
{
@@ -69,15 +75,7 @@ public override bool Execute()
6975
pkgSrc.Add(new XElement("package", new XAttribute("pattern", packagePattern)));
7076
}
7177

72-
if (pkgSrcMappingClearElement != null)
73-
{
74-
pkgSrcMappingClearElement.AddAfterSelf(pkgSrc);
75-
}
76-
else
77-
{
78-
pkgSrcMappingElement.AddFirst(pkgSrc);
79-
pkgSrcMappingElement.AddFirst(new XElement("clear"));
80-
}
78+
pkgSrcMappingElement.AddAfterSelf(pkgSrc);
8179
}
8280

8381
using (var writer = XmlWriter.Create(NuGetConfigFile, new XmlWriterSettings { NewLineChars = newLineChars, Indent = true }))

0 commit comments

Comments
 (0)