From 0f217514062351984afd5976bcd4d0e50c3fc15a Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Tue, 19 Dec 2023 12:01:09 -0600 Subject: [PATCH] Distinct target RIDs. --- .../MatchCompatibleRuntimeIdentifierItems.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/IKVM.Core.MSBuild.Tasks/MatchCompatibleRuntimeIdentifierItems.cs b/src/IKVM.Core.MSBuild.Tasks/MatchCompatibleRuntimeIdentifierItems.cs index be5f2ac..4aeb7eb 100644 --- a/src/IKVM.Core.MSBuild.Tasks/MatchCompatibleRuntimeIdentifierItems.cs +++ b/src/IKVM.Core.MSBuild.Tasks/MatchCompatibleRuntimeIdentifierItems.cs @@ -122,7 +122,7 @@ static bool IsImport(string rid, string importRid) /// public override bool Execute() { - MatchCompatibleItems(TargetRuntimeIdentifiers.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)); + MatchCompatibleItems(TargetRuntimeIdentifiers.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Distinct()); return true; } @@ -130,13 +130,10 @@ public override bool Execute() /// For each group of items defined by the GroupKey, append metadata /// /// - /// - void MatchCompatibleItems(ICollection targetRids) + void MatchCompatibleItems(IEnumerable targetRids) { if (targetRids is null) throw new ArgumentNullException(nameof(targetRids)); - if (targetRids.Count == 0) - throw new ArgumentOutOfRangeException(nameof(targetRids)); // group items and match group foreach (var group in Items.GroupBy(i => GroupKeyMetadataName != null ? (i.GetMetadata(GroupKeyMetadataName) ?? "") : ""))