-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tolerate breaking changes in BDN >= 0.13.8-nightly.20230901.67
Supports BDN 0.13.7 and nightly builds up to at least BDN 0.13.8-nightly.20230901.67 Closes #263, closes #259.
- Loading branch information
Showing
4 changed files
with
102 additions
and
8 deletions.
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
src/Mawosoft.Extensions.BenchmarkDotNet/ApiCompat/SummaryWrapper.cs
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,92 @@ | ||
// Copyright (c) 2021-2023 Matthias Wolf, Mawosoft. | ||
|
||
namespace Mawosoft.Extensions.BenchmarkDotNet.ApiCompat; | ||
|
||
internal static class SummaryWrapper | ||
{ | ||
private static readonly ConstructorInfo? s_ctorStable; | ||
private static readonly ConstructorInfo? s_ctorNightly; | ||
|
||
[SuppressMessage("Performance", "CA1810:Initialize reference type static fields inline", | ||
Justification = "Multiple interdependent fields.")] | ||
static SummaryWrapper() | ||
{ | ||
s_ctorStable = typeof(Summary).GetConstructor(new[] | ||
{ | ||
typeof(string), | ||
typeof(ImmutableArray<BenchmarkReport>), | ||
typeof(HostEnvironmentInfo), | ||
typeof(string), | ||
typeof(string), | ||
typeof(TimeSpan), | ||
typeof(CultureInfo), | ||
typeof(ImmutableArray<ValidationError>), | ||
typeof(ImmutableArray<IColumnHidingRule>) | ||
}); | ||
if (s_ctorStable is null) | ||
{ | ||
s_ctorNightly = typeof(Summary).GetConstructor(new[] | ||
{ | ||
typeof(string), | ||
typeof(ImmutableArray<BenchmarkReport>), | ||
typeof(HostEnvironmentInfo), | ||
typeof(string), | ||
typeof(string), | ||
typeof(TimeSpan), | ||
typeof(CultureInfo), | ||
typeof(ImmutableArray<ValidationError>), | ||
typeof(ImmutableArray<IColumnHidingRule>), | ||
typeof(SummaryStyle) | ||
}); | ||
} | ||
} | ||
|
||
public static Summary Create( | ||
string title, | ||
ImmutableArray<BenchmarkReport> reports, | ||
HostEnvironmentInfo hostEnvironmentInfo, | ||
string resultsDirectoryPath, | ||
string logFilePath, | ||
TimeSpan totalTime, | ||
CultureInfo cultureInfo, | ||
ImmutableArray<ValidationError> validationErrors, | ||
ImmutableArray<IColumnHidingRule> columnHidingRules, | ||
SummaryStyle? summaryStyle = null) | ||
{ | ||
if (s_ctorStable != null) | ||
{ | ||
return (Summary)s_ctorStable.Invoke(new object?[] | ||
{ | ||
title, | ||
reports, | ||
hostEnvironmentInfo, | ||
resultsDirectoryPath, | ||
logFilePath, | ||
totalTime, | ||
cultureInfo, | ||
validationErrors, | ||
columnHidingRules | ||
}); | ||
} | ||
else if (s_ctorNightly != null) | ||
{ | ||
return (Summary)s_ctorNightly.Invoke(new object?[] | ||
{ | ||
title, | ||
reports, | ||
hostEnvironmentInfo, | ||
resultsDirectoryPath, | ||
logFilePath, | ||
totalTime, | ||
cultureInfo, | ||
validationErrors, | ||
columnHidingRules, | ||
summaryStyle | ||
}); | ||
} | ||
else | ||
{ | ||
throw new MissingMethodException(nameof(Summary), ".ctor"); | ||
} | ||
} | ||
} |
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