Skip to content

Commit abd8c18

Browse files
committed
bring clarity to the RIDs
1 parent bfba2ac commit abd8c18

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Microsoft.NET.Build.Containers/Registry.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public readonly bool IsGoogleArtifactRegistry {
121121
async Task<Image?> TryPickBestImageFromManifestList(string repositoryName, string reference, ManifestListV2 manifestList, string runtimeIdentifier, string runtimeIdentifierGraphPath) {
122122
var runtimeGraph = GetRuntimeGraphForDotNet(runtimeIdentifierGraphPath);
123123
var (ridDict, graphForManifestList) = ConstructRuntimeGraphForManifestList(manifestList, runtimeGraph);
124-
var bestManifestRid = CheckIfRidExistsInGraph(graphForManifestList, runtimeIdentifier);
124+
var bestManifestRid = CheckIfRidExistsInGraph(graphForManifestList, ridDict.Keys, runtimeIdentifier);
125125
if (bestManifestRid is null) {
126126
throw new ArgumentException($"The runtimeIdentifier '{runtimeIdentifier}' is not supported. The supported RuntimeIdentifiers for the base image {repositoryName}:{reference} are {String.Join(",", graphForManifestList.Runtimes.Keys)}");
127127
}
@@ -146,12 +146,7 @@ async Task<HttpResponseMessage> GetBlob(string repositoryName, string digest)
146146
return response;
147147
}
148148

149-
private string? CheckIfRidExistsInGraph(RuntimeGraph graphForManifestList, string userRid) {
150-
var leafRids =
151-
graphForManifestList.Runtimes.Keys
152-
.Where(k => !graphForManifestList.Runtimes.Values.Any(r => r.InheritedRuntimes.Contains(k)));
153-
return leafRids.FirstOrDefault(leaf => graphForManifestList.AreCompatible(leaf, userRid));
154-
}
149+
private string? CheckIfRidExistsInGraph(RuntimeGraph graphForManifestList, IEnumerable<string> leafRids, string userRid) => leafRids.FirstOrDefault(leaf => graphForManifestList.AreCompatible(leaf, userRid));
155150

156151
private (IReadOnlyDictionary<string, PlatformSpecificManifest>, RuntimeGraph) ConstructRuntimeGraphForManifestList(ManifestListV2 manifestList, RuntimeGraph dotnetRuntimeGraph)
157152
{

0 commit comments

Comments
 (0)