From 889042aa03c34cf1311f0aa0a0cac01df99c15ab Mon Sep 17 00:00:00 2001 From: Ed Ball Date: Thu, 14 Nov 2024 15:47:38 -0800 Subject: [PATCH 1/2] Allow tool to roll forward through major versions. Drop end of life frameworks. Use NETSTANDARD2_0 as needed. --- Directory.Packages.props | 4 ++-- src/Facility.CodeGen.CSharp/CSharpUtility.cs | 2 +- .../Facility.CodeGen.CSharp.csproj | 2 +- .../Facility.Core.Assertions.csproj | 2 +- .../Facility.Core.MessagePack.csproj | 2 +- src/Facility.Core/Facility.Core.csproj | 6 +++--- src/Facility.Core/Http/BytesHttpContentSerializer.cs | 2 +- src/Facility.Core/Http/HttpClientService.cs | 6 +++--- src/Facility.Core/Http/HttpContentSerializer.cs | 2 +- src/Facility.Core/Http/JsonHttpContentSerializer.cs | 4 ++-- src/Facility.Core/Http/ServiceHttpContext.cs | 6 +++--- src/Facility.Core/Http/ServiceHttpHandler.cs | 10 +++++----- .../Http/StandardHttpContentSerializer.cs | 7 ++----- src/Facility.Core/Http/TextHttpContentSerializer.cs | 2 +- src/FacilityConformance/FacilityConformance.csproj | 3 ++- src/fsdgencsharp/fsdgencsharp.csproj | 3 ++- 16 files changed, 31 insertions(+), 32 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index a9267865..d0c77748 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,8 +6,8 @@ - - + + diff --git a/src/Facility.CodeGen.CSharp/CSharpUtility.cs b/src/Facility.CodeGen.CSharp/CSharpUtility.cs index 9631cf9c..137cb267 100644 --- a/src/Facility.CodeGen.CSharp/CSharpUtility.cs +++ b/src/Facility.CodeGen.CSharp/CSharpUtility.cs @@ -96,7 +96,7 @@ public static string CreateString(string text) return builder.ToString(); } -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 internal static bool ContainsOrdinal(this string text, char ch) => text.Contains(ch, StringComparison.Ordinal); #else internal static bool ContainsOrdinal(this string text, char ch) => text.Contains(ch); diff --git a/src/Facility.CodeGen.CSharp/Facility.CodeGen.CSharp.csproj b/src/Facility.CodeGen.CSharp/Facility.CodeGen.CSharp.csproj index 781615db..33a286e2 100644 --- a/src/Facility.CodeGen.CSharp/Facility.CodeGen.CSharp.csproj +++ b/src/Facility.CodeGen.CSharp/Facility.CodeGen.CSharp.csproj @@ -1,7 +1,7 @@ - netstandard2.0;net6.0;net7.0;net8.0 + netstandard2.0;net8.0 A library that generates C# for a Facility Service Definition. Facility FSD C# CodeGen true diff --git a/src/Facility.Core.Assertions/Facility.Core.Assertions.csproj b/src/Facility.Core.Assertions/Facility.Core.Assertions.csproj index 2f97c37d..178c7159 100644 --- a/src/Facility.Core.Assertions/Facility.Core.Assertions.csproj +++ b/src/Facility.Core.Assertions/Facility.Core.Assertions.csproj @@ -1,7 +1,7 @@ - netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0 + netstandard2.0;net8.0 FluentAssertions extensions for Facility unit tests. Facility FluentAssertions test testing true diff --git a/src/Facility.Core.MessagePack/Facility.Core.MessagePack.csproj b/src/Facility.Core.MessagePack/Facility.Core.MessagePack.csproj index 007cd3c2..5e6c860a 100644 --- a/src/Facility.Core.MessagePack/Facility.Core.MessagePack.csproj +++ b/src/Facility.Core.MessagePack/Facility.Core.MessagePack.csproj @@ -1,7 +1,7 @@ - netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0 + netstandard2.0;net8.0 MesssagePack support for Facility. Facility FSD MessagePack true diff --git a/src/Facility.Core/Facility.Core.csproj b/src/Facility.Core/Facility.Core.csproj index 8c5ce131..dff5bd6d 100644 --- a/src/Facility.Core/Facility.Core.csproj +++ b/src/Facility.Core/Facility.Core.csproj @@ -1,7 +1,7 @@ - netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0 + netstandard2.0;net8.0 A library for consuming/implementing Facility APIs. Facility FSD Core true @@ -14,8 +14,8 @@ - - + + diff --git a/src/Facility.Core/Http/BytesHttpContentSerializer.cs b/src/Facility.Core/Http/BytesHttpContentSerializer.cs index fbbe8727..3b30db20 100644 --- a/src/Facility.Core/Http/BytesHttpContentSerializer.cs +++ b/src/Facility.Core/Http/BytesHttpContentSerializer.cs @@ -51,7 +51,7 @@ protected override async Task> ReadHttpContentAsyncCore(Ty { if (objectType == typeof(byte[])) { -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 var contentValue = await content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false); #else var contentValue = await content.ReadAsByteArrayAsync().ConfigureAwait(false); diff --git a/src/Facility.Core/Http/HttpClientService.cs b/src/Facility.Core/Http/HttpClientService.cs index 53ab2cf2..b5b31e70 100644 --- a/src/Facility.Core/Http/HttpClientService.cs +++ b/src/Facility.Core/Http/HttpClientService.cs @@ -248,7 +248,7 @@ private async IAsyncEnumerable> CreateAsyncEnumerable> CreateAsyncEnumerable> ReadHttpContentAsync(Type objectType, H if (content.Headers.ContentLength is null) { -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 var contentValue = await content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false); #else var contentValue = await content.ReadAsByteArrayAsync().ConfigureAwait(false); diff --git a/src/Facility.Core/Http/JsonHttpContentSerializer.cs b/src/Facility.Core/Http/JsonHttpContentSerializer.cs index e14cb33f..abed4c7b 100644 --- a/src/Facility.Core/Http/JsonHttpContentSerializer.cs +++ b/src/Facility.Core/Http/JsonHttpContentSerializer.cs @@ -75,7 +75,7 @@ protected override async Task> ReadHttpContentAsyncCore(Ty { // read content into memory so that ASP.NET Core doesn't complain about synchronous I/O during JSON deserialization using var stream = CreateMemoryStream(); -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 await content.CopyToAsync(stream, cancellationToken).ConfigureAwait(false); #else await content.CopyToAsync(stream).ConfigureAwait(false); @@ -85,7 +85,7 @@ protected override async Task> ReadHttpContentAsyncCore(Ty } else { -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 using var stream = await content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); #else using var stream = await content.ReadAsStreamAsync().ConfigureAwait(false); diff --git a/src/Facility.Core/Http/ServiceHttpContext.cs b/src/Facility.Core/Http/ServiceHttpContext.cs index bff6e920..202f44d4 100644 --- a/src/Facility.Core/Http/ServiceHttpContext.cs +++ b/src/Facility.Core/Http/ServiceHttpContext.cs @@ -20,7 +20,7 @@ public sealed class ServiceHttpContext /// public static ServiceHttpContext? TryGetContext(HttpRequestMessage httpRequest) { -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 httpRequest.Options.TryGetValue(s_requestPropertyContextKey, out var context); return context; #else @@ -40,14 +40,14 @@ public sealed class ServiceHttpContext internal static void SetContext(HttpRequestMessage httpRequest, ServiceHttpContext context) { -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 httpRequest.Options.Set(s_requestPropertyContextKey, context); #else httpRequest.Properties[c_requestPropertyContextKey] = context; #endif } -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 private static readonly HttpRequestOptionsKey s_requestPropertyContextKey = new("Facility_Context"); #else private const string c_requestPropertyContextKey = "Facility_Context"; diff --git a/src/Facility.Core/Http/ServiceHttpHandler.cs b/src/Facility.Core/Http/ServiceHttpHandler.cs index c4ad0ddd..8c9b539f 100644 --- a/src/Facility.Core/Http/ServiceHttpHandler.cs +++ b/src/Facility.Core/Http/ServiceHttpHandler.cs @@ -286,7 +286,7 @@ public EventStreamHttpContent(IAsyncEnumerable> enumera protected override Task SerializeToStreamAsync(Stream stream, TransportContext? context) => DoSerializeToStreamAsync(stream, CancellationToken.None); -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 protected override Task SerializeToStreamAsync(Stream stream, TransportContext? context, CancellationToken cancellationToken) => DoSerializeToStreamAsync(stream, cancellationToken); #endif @@ -321,20 +321,20 @@ private async Task DoSerializeToStreamAsync(Stream stream, CancellationToken can if (isError) { -#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER +#if !NETSTANDARD2_0 await stream.WriteAsync(s_errorEventLine, cancellationToken).ConfigureAwait(false); #else await stream.WriteAsync(s_errorEventLine.ToArray(), 0, s_errorEventLine.Length, cancellationToken).ConfigureAwait(false); #endif } -#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER +#if !NETSTANDARD2_0 await stream.WriteAsync(s_dataPrefix, cancellationToken).ConfigureAwait(false); #else await stream.WriteAsync(s_dataPrefix.ToArray(), 0, s_dataPrefix.Length, cancellationToken).ConfigureAwait(false); #endif -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 using (var content = m_contentSerializer.CreateHttpContent(dto)) await content.CopyToAsync(stream, cancellationToken).ConfigureAwait(false); #else @@ -342,7 +342,7 @@ private async Task DoSerializeToStreamAsync(Stream stream, CancellationToken can await content.CopyToAsync(stream).ConfigureAwait(false); #endif -#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER +#if !NETSTANDARD2_0 await stream.WriteAsync(s_twoNewlines, cancellationToken).ConfigureAwait(false); #else await stream.WriteAsync(s_twoNewlines.ToArray(), 0, s_twoNewlines.Length, cancellationToken).ConfigureAwait(false); diff --git a/src/Facility.Core/Http/StandardHttpContentSerializer.cs b/src/Facility.Core/Http/StandardHttpContentSerializer.cs index b67f9fb7..eb033dee 100644 --- a/src/Facility.Core/Http/StandardHttpContentSerializer.cs +++ b/src/Facility.Core/Http/StandardHttpContentSerializer.cs @@ -21,12 +21,9 @@ protected override async Task> ReadHttpContentAsyncCore(Ty { try { -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 var stream = await content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); await using var streamScope = stream.ConfigureAwait(false); -#elif NETSTANDARD2_1_OR_GREATER - var stream = await content.ReadAsStreamAsync().ConfigureAwait(false); - await using var streamScope = stream.ConfigureAwait(false); #else using var stream = await content.ReadAsStreamAsync().ConfigureAwait(false); #endif @@ -54,7 +51,7 @@ public DelegateHttpContent(string mediaType, object content, ServiceSerializer s protected override Task SerializeToStreamAsync(Stream stream, TransportContext? context) => DoSerializeToStreamAsync(stream, CancellationToken.None); -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 protected override Task SerializeToStreamAsync(Stream stream, TransportContext? context, CancellationToken cancellationToken) => DoSerializeToStreamAsync(stream, cancellationToken); #endif diff --git a/src/Facility.Core/Http/TextHttpContentSerializer.cs b/src/Facility.Core/Http/TextHttpContentSerializer.cs index fa1e55f0..9bee90af 100644 --- a/src/Facility.Core/Http/TextHttpContentSerializer.cs +++ b/src/Facility.Core/Http/TextHttpContentSerializer.cs @@ -52,7 +52,7 @@ protected override async Task> ReadHttpContentAsyncCore(Ty { if (objectType == typeof(string)) { -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 var stringValue = await content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); #else var stringValue = await content.ReadAsStringAsync().ConfigureAwait(false); diff --git a/src/FacilityConformance/FacilityConformance.csproj b/src/FacilityConformance/FacilityConformance.csproj index a7c993f2..60a845a5 100644 --- a/src/FacilityConformance/FacilityConformance.csproj +++ b/src/FacilityConformance/FacilityConformance.csproj @@ -2,11 +2,12 @@ Exe - net6.0;net7.0;net8.0 + net8.0 A tool that checks Facility conformance. Facility conformance true true + Major README.md diff --git a/src/fsdgencsharp/fsdgencsharp.csproj b/src/fsdgencsharp/fsdgencsharp.csproj index 97f2206d..9c20df55 100644 --- a/src/fsdgencsharp/fsdgencsharp.csproj +++ b/src/fsdgencsharp/fsdgencsharp.csproj @@ -2,11 +2,12 @@ Exe - net6.0;net7.0;net8.0 + net8.0 A tool that generates C# for a Facility Service Definition. Facility FSD C# CodeGen true true + Major README.md From 3717a0863ff18e3d658559b2c3704d17e0f1c659 Mon Sep 17 00:00:00 2001 From: Ed Ball Date: Thu, 14 Nov 2024 15:48:48 -0800 Subject: [PATCH 2/2] Publish 2.30.0. --- Directory.Build.props | 4 ++-- ReleaseNotes.md | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 3a509867..56ee546f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,8 +1,8 @@ - 2.29.4 - 2.29.3 + 2.30.0 + 2.29.4 12.0 enable enable diff --git a/ReleaseNotes.md b/ReleaseNotes.md index a17ed464..4317328d 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,5 +1,10 @@ # Release Notes +## 2.30.0 + +* Drop support for end-of-life frameworks. +* Use roll forward with .NET tools. + ## 2.29.4 * Bump `MessagePack` and `System.Text.Json` versions to address vulnerabilities.