From eabff1b44134b7549ce410b49a478505411519ab Mon Sep 17 00:00:00 2001 From: Ian Griffiths Date: Tue, 7 Dec 2021 20:23:26 +0000 Subject: [PATCH] Upgrade specs and benchmarks to .NET 6.0 (#142) * 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 --- .gitignore | 5 +- .../Ais.Net.Benchmarks.csproj | 17 +- Solutions/Ais.Net.Benchmarks/Program.cs | 10 +- Solutions/Ais.Net.Specs/Ais.Net.Specs.csproj | 11 +- ...ongRangeAisBroadcastParserSpecs.feature.cs | 558 ------- ...PositionReportClassAParserSpecs.feature.cs | 914 ----------- ...PositionReportClassBParserSpecs.feature.cs | 930 ----------- ...ReportExtendedClassBParserSpecs.feature.cs | 1043 ------------ ...AndVoyageRelatedDataParserSpecs.feature.cs | 1068 ------------ .../StaticDataReportParserSpecs.feature.cs | 1108 ------------- .../Ais/Net/Specs/AisStringsSpecs.feature.cs | 182 --- .../NmeaAisBitVectorParserSpecs.feature.cs | 346 ---- ...NmeaLineToAisStreamAdapterSpecs.feature.cs | 1420 ---------------- .../NmeaStreamParserByLineSpecs.feature.cs | 939 ----------- .../NmeaStreamParserByMessageSpecs.feature.cs | 1440 ----------------- .../Net/Specs/ParsePayloadSpecs.feature.cs | 6 +- .../Net/Specs/SentenceLayerSpecs.feature.cs | 6 +- Solutions/Ais.Net/Ais.Net.csproj | 8 +- Solutions/Common.Net.proj | 2 +- azure-pipelines.yml | 7 + 20 files changed, 47 insertions(+), 9973 deletions(-) delete mode 100644 Solutions/Ais.Net.Specs/Ais/Net/Specs/AisMessageTypes/LongRangeAisBroadcastParserSpecs.feature.cs delete mode 100644 Solutions/Ais.Net.Specs/Ais/Net/Specs/AisMessageTypes/PositionReportClassAParserSpecs.feature.cs delete mode 100644 Solutions/Ais.Net.Specs/Ais/Net/Specs/AisMessageTypes/PositionReportClassBParserSpecs.feature.cs delete mode 100644 Solutions/Ais.Net.Specs/Ais/Net/Specs/AisMessageTypes/PositionReportExtendedClassBParserSpecs.feature.cs delete mode 100644 Solutions/Ais.Net.Specs/Ais/Net/Specs/AisMessageTypes/StaticAndVoyageRelatedDataParserSpecs.feature.cs delete mode 100644 Solutions/Ais.Net.Specs/Ais/Net/Specs/AisMessageTypes/StaticDataReportParserSpecs.feature.cs delete mode 100644 Solutions/Ais.Net.Specs/Ais/Net/Specs/AisStringsSpecs.feature.cs delete mode 100644 Solutions/Ais.Net.Specs/Ais/Net/Specs/NmeaAisBitVectorParserSpecs.feature.cs delete mode 100644 Solutions/Ais.Net.Specs/Ais/Net/Specs/NmeaLineToAisStreamAdapterSpecs.feature.cs delete mode 100644 Solutions/Ais.Net.Specs/Ais/Net/Specs/NmeaStreamParserByLineSpecs.feature.cs delete mode 100644 Solutions/Ais.Net.Specs/Ais/Net/Specs/NmeaStreamParserByMessageSpecs.feature.cs diff --git a/.gitignore b/.gitignore index 907b75f..c18cd8c 100644 --- a/.gitignore +++ b/.gitignore @@ -336,4 +336,7 @@ ASALocalRun/ coverage.cobertura.xml # VS Code config files -/.vscode \ No newline at end of file +/.vscode + +# Generated SpecFlow files +*.feature.cs \ No newline at end of file diff --git a/Solutions/Ais.Net.Benchmarks/Ais.Net.Benchmarks.csproj b/Solutions/Ais.Net.Benchmarks/Ais.Net.Benchmarks.csproj index 3088075..2826f3c 100644 --- a/Solutions/Ais.Net.Benchmarks/Ais.Net.Benchmarks.csproj +++ b/Solutions/Ais.Net.Benchmarks/Ais.Net.Benchmarks.csproj @@ -1,9 +1,13 @@  - + + net6.0 + + + - Exe + Exe false @@ -14,7 +18,7 @@ - + @@ -25,4 +29,11 @@ + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/Solutions/Ais.Net.Benchmarks/Program.cs b/Solutions/Ais.Net.Benchmarks/Program.cs index 0a4b3b9..373f64e 100644 --- a/Solutions/Ais.Net.Benchmarks/Program.cs +++ b/Solutions/Ais.Net.Benchmarks/Program.cs @@ -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 { @@ -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(config); } diff --git a/Solutions/Ais.Net.Specs/Ais.Net.Specs.csproj b/Solutions/Ais.Net.Specs/Ais.Net.Specs.csproj index 601b609..c209832 100644 --- a/Solutions/Ais.Net.Specs/Ais.Net.Specs.csproj +++ b/Solutions/Ais.Net.Specs/Ais.Net.Specs.csproj @@ -1,8 +1,13 @@ - - false + net6.0 + + + + + + false - netstandard2.1;netstandard2.0;netcoreapp2.1 + netstandard2.1;netstandard2.0 @@ -26,7 +22,7 @@ - + AGPL-3.0-only High performance, zero allocation AIS message decoder, which can process millions of AIVDM/AIVDO sentences per second on a single core. Sponsored by endjin. diff --git a/Solutions/Common.Net.proj b/Solutions/Common.Net.proj index b16b9e9..d3e5fc7 100644 --- a/Solutions/Common.Net.proj +++ b/Solutions/Common.Net.proj @@ -7,7 +7,7 @@ latest $(OutputPath)$(TargetFramework.ToLowerInvariant())\$(AssemblyName).xml - Copyright (c) Endjin Limited 2019. All rights reserved. + Copyright (c) Endjin Limited 2021. All rights reserved. diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dd9ba67..713361b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,6 +21,13 @@ jobs: service_connection_nuget_org: $(Endjin_Service_Connection_NuGet_Org) service_connection_github: $(Endjin_Service_Connection_GitHub) solution_to_build: $(Endjin_Solution_To_Build) + preCustomEnvironmentVariables: + - task: UseDotNet@2 + displayName: 'Install .NET SDK 6.0' + inputs: + packageType: sdk + version: 6.0.x + installationPath: $(Agent.ToolsDirectory)/dotnet postSpecs: - task: DotNetCoreCLI@2 displayName: 'Run benchmarks'