From 4f741579382be18e6d482acedc26eb6b86651a58 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Wed, 21 Apr 2021 12:03:00 +0200 Subject: [PATCH 1/4] Add .NET 5.0 support While we're at it, clean up the conditional compliation constants and dependencies: - Define `SPAN_NATIVE` on all platforms _except_ `net45` and `netstandard2.0` (so it's defined automatically on new .NET versions) - Only add `System.Memory` dependency on `net45` and `netstandard2.0`. - Fix `NATIVE_SPAN` typo - Remove obsolete `NETCORE` preprocessor variable. --- plist-cil.benchmark/plist-cil.benchmark.csproj | 4 ++-- plist-cil.test/NSNumberTests.cs | 3 --- plist-cil.test/plist-cil.test.csproj | 12 ++++-------- plist-cil/BinaryPropertyListWriter.cs | 4 ++-- plist-cil/plist-cil.csproj | 14 +++++--------- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/plist-cil.benchmark/plist-cil.benchmark.csproj b/plist-cil.benchmark/plist-cil.benchmark.csproj index 1ce0f46..36cc1e8 100644 --- a/plist-cil.benchmark/plist-cil.benchmark.csproj +++ b/plist-cil.benchmark/plist-cil.benchmark.csproj @@ -2,12 +2,12 @@ Exe - netcoreapp2.1 + net5.0 Claunia.PropertyList.Benchmark - + diff --git a/plist-cil.test/NSNumberTests.cs b/plist-cil.test/NSNumberTests.cs index 9075a3f..299821e 100644 --- a/plist-cil.test/NSNumberTests.cs +++ b/plist-cil.test/NSNumberTests.cs @@ -110,8 +110,6 @@ namespace plistcil.test // The value being used comes seen in a real property list: // TimeZoneOffsetFromUTC // 7200.000000 - - #if !NETCORE [Fact] [UseCulture("en-US")] public static void ParseNumberEnTest() @@ -156,7 +154,6 @@ namespace plistcil.test Assert.True(number.isReal()); Assert.Equal(7200d, number.ToDouble()); } -#endif public static IEnumerable StringConstructorTestData() { diff --git a/plist-cil.test/plist-cil.test.csproj b/plist-cil.test/plist-cil.test.csproj index cb0a71d..6f69214 100644 --- a/plist-cil.test/plist-cil.test.csproj +++ b/plist-cil.test/plist-cil.test.csproj @@ -1,19 +1,15 @@  - netcoreapp2.0 + net5.0 - - - + + + - - NETCOREAPP1_0;NETCORE - - diff --git a/plist-cil/BinaryPropertyListWriter.cs b/plist-cil/BinaryPropertyListWriter.cs index 8608dcd..18334af 100644 --- a/plist-cil/BinaryPropertyListWriter.cs +++ b/plist-cil/BinaryPropertyListWriter.cs @@ -355,10 +355,10 @@ namespace Claunia.PropertyList internal void Write(Span bytes) { - #if SPAN_NATIVE + #if NATIVE_SPAN outStream.Write(bytes); count += bytes.Length; -#else + #else Write(bytes.ToArray()); #endif } diff --git a/plist-cil/plist-cil.csproj b/plist-cil/plist-cil.csproj index 6af09bc..1f3364b 100644 --- a/plist-cil/plist-cil.csproj +++ b/plist-cil/plist-cil.csproj @@ -1,7 +1,7 @@  - net45;netcoreapp2.0;netstandard2.0;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1 + net45;netstandard2.0;netcoreapp2.1;netcoreapp3.1;net5.0 2.1 Natalia Portillo Claunia.com @@ -36,12 +36,8 @@ Use invariant culture to format NSDate. TRACE;DEBUG - - - $(DefineConstants);NETCORE - - - + + $(DefineConstants);NATIVE_SPAN @@ -49,8 +45,8 @@ Use invariant culture to format NSDate. - - + + From ad0f8aa9154c0635ad85710e47d1e6b21a3f8721 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Wed, 21 Apr 2021 12:08:40 +0200 Subject: [PATCH 2/4] Update README --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c600f7a..3f20e65 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,15 @@ They originate from the NeXTSTEP programming environment and are now a basic par * Cocoa / NeXTSTEP / GNUstep ASCII ## Requirements -.NET Framework 4.0, Mono or .NET Core. -Targets .NET Framework 4.0, .NET Framework 4.5, .NET Standard 1.3, .NET Standard 1.4 and .NET Standard 1.6 so it should be compatible with Mono, Xamarin.iOS, Xamarin.Mac, UWP, etc. -If you find an incompatibility, please create an issue. +plist-cil targets: + +- .NET Framework 4.5, +- .NET Standard 2.0 +- .NET Core 2.1 +- .NET Core 3.1. +- .NET 5.0 + +This means it should be compatible with Mono, Xamarin.iOS, Xamarin.Mac, UWP, etc. If you find an incompatibility, please create an issue. ## Download From b5b9d5189ef2ea5a7bb7e2a88c1302c115d4dc71 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Wed, 21 Apr 2021 13:02:02 +0200 Subject: [PATCH 3/4] Replace CoreJob with SimpleJob(RuntimeMoniker.NetCoreApp50) --- plist-cil.benchmark/BinaryPropertyListParserBenchmarks.cs | 8 ++++---- plist-cil.benchmark/BinaryPropertyListWriterBenchmarks.cs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plist-cil.benchmark/BinaryPropertyListParserBenchmarks.cs b/plist-cil.benchmark/BinaryPropertyListParserBenchmarks.cs index 2885af7..881223e 100644 --- a/plist-cil.benchmark/BinaryPropertyListParserBenchmarks.cs +++ b/plist-cil.benchmark/BinaryPropertyListParserBenchmarks.cs @@ -1,10 +1,10 @@ -using System.IO; -using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Attributes.Jobs; +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Jobs; +using System.IO; namespace Claunia.PropertyList.Benchmark { - [CoreJob] + [SimpleJob(RuntimeMoniker.NetCoreApp50)] [MemoryDiagnoser] public class BinaryPropertyListParserBenchmarks { diff --git a/plist-cil.benchmark/BinaryPropertyListWriterBenchmarks.cs b/plist-cil.benchmark/BinaryPropertyListWriterBenchmarks.cs index f40b807..3196637 100644 --- a/plist-cil.benchmark/BinaryPropertyListWriterBenchmarks.cs +++ b/plist-cil.benchmark/BinaryPropertyListWriterBenchmarks.cs @@ -1,9 +1,9 @@ using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Attributes.Jobs; +using BenchmarkDotNet.Jobs; namespace Claunia.PropertyList.Benchmark { - [CoreJob] + [SimpleJob(RuntimeMoniker.NetCoreApp50)] [MemoryDiagnoser] public class BinaryPropertyListWriterBenchmarks { From 65cee57929ddccf8f96f9acc861acf097f2a8967 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Wed, 21 Apr 2021 13:02:40 +0200 Subject: [PATCH 4/4] Travis: Use .NET 5.0 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c1de8cb..6afbb51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: csharp solution: plist-cil.sln mono: - none -dotnet: 2.2 +dotnet: 5.0 dist: bionic git: depth: false