-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make AnalyzerResults deterministically ordered
The order itself is not relevant (the `NuGetFrameworkSorter` used to sort target frameworks doesn't guarantee any specific order anyway) but the order is deterministic, meaning that several builds of the same project will always yield the same order of the target frameworks and results. The nondeterministic nature of the current implementation made it hard to diagnose an implementation issue in Stryker.NET: stryker-mutator/stryker-net#1899 (comment)
- Loading branch information
1 parent
82e9c60
commit 524bfee
Showing
4 changed files
with
31 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Collections.Generic; | ||
using NuGet.Frameworks; | ||
|
||
namespace Buildalyzer | ||
{ | ||
internal class TargetFrameworkComparer : IComparer<string> | ||
{ | ||
public static readonly TargetFrameworkComparer Instance = new TargetFrameworkComparer(); | ||
|
||
private static readonly NuGetFrameworkSorter Sorter = new NuGetFrameworkSorter(); | ||
|
||
private TargetFrameworkComparer() | ||
{ | ||
} | ||
|
||
public int Compare(string x, string y) | ||
{ | ||
NuGetFramework xFramework = NuGetFramework.ParseFolder(x); | ||
NuGetFramework yFramework = NuGetFramework.ParseFolder(y); | ||
return Sorter.Compare(xFramework, yFramework); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters