Skip to content

Commit

Permalink
Upgrade specs and benchmarks to .NET 6.0 (#142)
Browse files Browse the repository at this point in the history
* Update to .NET 6.0
Replace Obsolete BenchmarkDot APIs with preferred approaches.

* Revert unnecessary upgrade

The Ais.Net project itself does not benefit at all from being upgraded to .NET 6.0. It turns out that all the gains can be had simply by loading the existing library into a .NET 6.0 application. The existing library targetting .netstandard2.1 performs exactly as well as one targetting .NET 6.0 directly (even if we upgrade to the latest System.Io.Pipelines) so there's no need for us to do a new release.

* Remove SourceLink from specs & benchmark

We don't publish the spec or benchmark projects as a library so there's no reason for them to use sourcelink.

* Add .NET 6.0 SDK to build

* Remove .NET Core 2.1 support

Looks like it won't build unless we do this.

* I hate yaml

* Attempt to fix broken build

Co-authored-by: Howard van Rooijen <Howard.vanRooijen@endjin.com>
  • Loading branch information
idg10 and HowardvanRooijen committed Dec 7, 2021
1 parent e5c10dc commit eabff1b
Show file tree
Hide file tree
Showing 20 changed files with 47 additions and 9,973 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,7 @@ ASALocalRun/
coverage.cobertura.xml

# VS Code config files
/.vscode
/.vscode

# Generated SpecFlow files
*.feature.cs
17 changes: 14 additions & 3 deletions Solutions/Ais.Net.Benchmarks/Ais.Net.Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\Common.NetCore_3_1.proj" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<Import Project="..\Common.Net.proj" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand All @@ -14,7 +18,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.0" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
</ItemGroup>

<ItemGroup>
Expand All @@ -25,4 +29,11 @@
<Folder Include="TestData\" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions Solutions/Ais.Net.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ private static void Main(string[] args)
{
Job job = Job.Default;
IConfig config = DefaultConfig.Instance
.With(MemoryDiagnoser.Default);
.AddDiagnoser(MemoryDiagnoser.Default);

if (args.Length == 1 && args[0] == "inprocess")
{
job = job
.WithMinWarmupCount(2)
.WithMaxWarmupCount(4)
.With(InProcessEmitToolchain.Instance);
config = config.With(ConfigOptions.DisableOptimizationsValidator);
.WithToolchain(InProcessEmitToolchain.Instance);
config = config.WithOptions(ConfigOptions.DisableOptimizationsValidator);
}
else
{
Expand All @@ -65,11 +65,11 @@ private static void Main(string[] args)
if (args.Length > 1)
{
string version = args[1];
job = job.With(new Argument[] { new MsBuildArgument($"/p:Version={version}") });
job = job.WithArguments(new Argument[] { new MsBuildArgument($"/p:Version={version}") });
}
}

config = config.With(job);
config = config.AddJob(job);

BenchmarkRunner.Run<AisNetBenchmarks>(config);
}
Expand Down
11 changes: 8 additions & 3 deletions Solutions/Ais.Net.Specs/Ais.Net.Specs.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\Common.NetCore_3_1.proj" />
<PropertyGroup>
<IsPackable>false</IsPackable>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<Import Project="..\Common.Net.proj" />

<PropertyGroup>
<IsPackable>false</IsPackable>
<!--
Note: SA1633 and SA1649 are disabled because of a bug introduced by SpecFlow 3.1.
If https://github.com/SpecFlowOSS/SpecFlow/pull/1790 is ever successfully merged, we should re-enable them.
Expand All @@ -11,7 +16,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.4" />
<PackageReference Include="Corvus.Testing.SpecFlow.NUnit" Version="1.4.5" />
<PackageReference Include="Corvus.Testing.SpecFlow.NUnit" Version="1.4.6" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Ais.Net\Ais.Net.csproj" />
Expand Down
Loading

0 comments on commit eabff1b

Please sign in to comment.