Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow tool to roll forward through major versions. #101

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>

<PropertyGroup>
<VersionPrefix>2.29.4</VersionPrefix>
<PackageValidationBaselineVersion>2.29.3</PackageValidationBaselineVersion>
<VersionPrefix>2.30.0</VersionPrefix>
<PackageValidationBaselineVersion>2.29.4</PackageValidationBaselineVersion>
<LangVersion>12.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<PackageVersion Include="ArgsReading" Version="2.3.2" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" />
<PackageVersion Include="Facility.AspNetCore" Version="3.8.0" />
<PackageVersion Include="Facility.Definition" Version="2.14.0" />
<PackageVersion Include="Facility.CodeGen.Console" Version="2.14.0" />
<PackageVersion Include="Facility.Definition" Version="2.15.0" />
<PackageVersion Include="Facility.CodeGen.Console" Version="2.15.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="MessagePack" Version="2.5.192" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
Expand Down
5 changes: 5 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/Facility.CodeGen.CSharp/CSharpUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Facility.CodeGen.CSharp/Facility.CodeGen.CSharp.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
<Description>A library that generates C# for a Facility Service Definition.</Description>
<PackageTags>Facility FSD C# CodeGen</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
<Description>FluentAssertions extensions for Facility unit tests.</Description>
<PackageTags>Facility FluentAssertions test testing</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
<Description>MesssagePack support for Facility.</Description>
<PackageTags>Facility FSD MessagePack</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
6 changes: 3 additions & 3 deletions src/Facility.Core/Facility.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
<Description>A library for consuming/implementing Facility APIs.</Description>
<PackageTags>Facility FSD Core</PackageTags>
<IsPackable>true</IsPackable>
Expand All @@ -14,8 +14,8 @@
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' ">
<PackageReference Include="System.Text.Json" VersionOverride="6.0.11" />
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Text.Json" VersionOverride="8.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Facility.Core/Http/BytesHttpContentSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected override async Task<ServiceResult<object>> 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);
Expand Down
6 changes: 3 additions & 3 deletions src/Facility.Core/Http/HttpClientService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private async IAsyncEnumerable<ServiceResult<TResponse>> CreateAsyncEnumerable<T
Stream? stream = null;
try
{
#if NET6_0_OR_GREATER
#if !NETSTANDARD2_0
stream = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
#else
stream = await httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);
Expand Down Expand Up @@ -329,7 +329,7 @@ private async IAsyncEnumerable<ServiceResult<TResponse>> CreateAsyncEnumerable<T
}
finally
{
#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER
#if !NETSTANDARD2_0
if (stream is not null)
await stream.DisposeAsync().ConfigureAwait(false);
#else
Expand Down Expand Up @@ -426,7 +426,7 @@ private static string GetUrlFromPattern(string url, IEnumerable<KeyValuePair<str
var bracketedKeyIndex = url.IndexOf(bracketedKey, StringComparison.Ordinal);
if (bracketedKeyIndex != -1)
{
#if NET6_0_OR_GREATER
#if !NETSTANDARD2_0
url = string.Concat(url.AsSpan(0, bracketedKeyIndex), Uri.EscapeDataString(parameter.Value), url.AsSpan(bracketedKeyIndex + bracketedKey.Length));
#else
url = url.Substring(0, bracketedKeyIndex) + Uri.EscapeDataString(parameter.Value) + url.Substring(bracketedKeyIndex + bracketedKey.Length);
Expand Down
2 changes: 1 addition & 1 deletion src/Facility.Core/Http/HttpContentSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public async Task<ServiceResult<object>> 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);
Expand Down
4 changes: 2 additions & 2 deletions src/Facility.Core/Http/JsonHttpContentSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected override async Task<ServiceResult<object>> 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);
Expand All @@ -85,7 +85,7 @@ protected override async Task<ServiceResult<object>> 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);
Expand Down
6 changes: 3 additions & 3 deletions src/Facility.Core/Http/ServiceHttpContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public sealed class ServiceHttpContext
/// </summary>
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
Expand All @@ -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<ServiceHttpContext> s_requestPropertyContextKey = new("Facility_Context");
#else
private const string c_requestPropertyContextKey = "Facility_Context";
Expand Down
10 changes: 5 additions & 5 deletions src/Facility.Core/Http/ServiceHttpHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public EventStreamHttpContent(IAsyncEnumerable<ServiceResult<TResponse>> 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
Expand Down Expand Up @@ -321,28 +321,28 @@ 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
using (var content = m_contentSerializer.CreateHttpContent(dto))
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);
Expand Down
7 changes: 2 additions & 5 deletions src/Facility.Core/Http/StandardHttpContentSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ protected override async Task<ServiceResult<object>> 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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Facility.Core/Http/TextHttpContentSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected override async Task<ServiceResult<object>> 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);
Expand Down
3 changes: 2 additions & 1 deletion src/FacilityConformance/FacilityConformance.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<Description>A tool that checks Facility conformance.</Description>
<PackageTags>Facility conformance</PackageTags>
<IsPackable>true</IsPackable>
<PackAsTool>true</PackAsTool>
<RollForward>Major</RollForward>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
3 changes: 2 additions & 1 deletion src/fsdgencsharp/fsdgencsharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<Description>A tool that generates C# for a Facility Service Definition.</Description>
<PackageTags>Facility FSD C# CodeGen</PackageTags>
<IsPackable>true</IsPackable>
<PackAsTool>true</PackAsTool>
<RollForward>Major</RollForward>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
Loading