From e66da3082097aebff2ff933e2d82eb088e1d2c15 Mon Sep 17 00:00:00 2001 From: Arne Kiesewetter Date: Fri, 28 Nov 2025 00:01:34 +0100 Subject: [PATCH] Upgrade targetting and project structure for net 10 --- .github/workflows/build.yml | 4 +-- .github/workflows/publish.yml | 4 +-- Directory.Build.props | 20 +++++++++---- .../AsyncTopologicalSortExtensions.cs | 29 +++++++++---------- .../EnumerableToolkit.Async.csproj | 20 ++----------- .../EnumerableToolkit.Builder.Async.csproj | 18 ++---------- .../EnumerableToolkit.Builder.csproj | 8 +---- EnumerableToolkit.Tests/AssemblyAttributes.cs | 1 + .../EnumerableToolkit.Tests.csproj | 16 ++++++---- EnumerableToolkit.sln | 9 ++++++ EnumerableToolkit/EnumerableToolkit.csproj | 8 ----- 11 files changed, 59 insertions(+), 78 deletions(-) create mode 100644 EnumerableToolkit.Tests/AssemblyAttributes.cs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0623281..16c33eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: - name: Setup Dotnet uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.x + dotnet-version: 10.x - name: Restore NuGet Package Cache uses: actions/cache/restore@v4 @@ -94,7 +94,7 @@ jobs: - name: Setup Dotnet uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.x + dotnet-version: 10.x - name: Restore NuGet Package Cache uses: actions/cache/restore@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6c8ab93..6c9a46d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -67,7 +67,7 @@ jobs: - name: Setup Dotnet uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.x + dotnet-version: 10.x # Publish all NuGet packages to the GitHub feed # Use --skip-duplicate to prevent errors if a package with the same version already exists. @@ -92,7 +92,7 @@ jobs: - name: Setup Dotnet uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.x + dotnet-version: 10.x # Publish all NuGet packages to the NuGet feed - name: Publish NuGet Packages (NuGet) diff --git a/Directory.Build.props b/Directory.Build.props index 6ff0bcb..a7864cb 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,25 +1,35 @@ Library - netstandard2.0 + net10.0;netstandard2.0;netstandard2.1 $(AssemblyTitle).dll - 12.0 + 13.0 enable enable true portable True + True + Banane9 + + IEnumerable; enumerable; tool; tools; toolkit; helper; linq + LGPL-3.0-or-later README.md + + + https://github.com/Banane9/EnumerableToolkit + $(PackageProjectUrl).git git - LGPL-3.0-or-later + True True True snupkg - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + @@ -27,7 +37,7 @@ - + False all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/EnumerableToolkit.Async/AsyncTopologicalSortExtensions.cs b/EnumerableToolkit.Async/AsyncTopologicalSortExtensions.cs index 4c15bd0..f9ea263 100644 --- a/EnumerableToolkit.Async/AsyncTopologicalSortExtensions.cs +++ b/EnumerableToolkit.Async/AsyncTopologicalSortExtensions.cs @@ -10,6 +10,9 @@ public static class AsyncTopologicalSortExtensions /// /// Outputs all nodes that are part of cycles, given an expression that produces a set of connected nodes. /// + /// + /// Note that this method requires a full evaluation of the input sequence to produce an output. + /// /// The input nodes. /// Gets the dependency identifier of a node. /// The expression producing connected nodes. @@ -17,7 +20,6 @@ public static class AsyncTopologicalSortExtensions /// The dependency connection type. /// All input nodes that are part of a cycle. public static async IAsyncEnumerable FindCycles(this IAsyncEnumerable nodes, Func identifier, Func> connected) - where TNode : notnull where TDependency : notnull { @@ -27,9 +29,9 @@ public static async IAsyncEnumerable FindCycles(this while (dependencies.Count > 0) { - var key = dependencies.FirstOrDefault(x => x.Value.Count == 0).Key + var key = (await dependencies.ToAsyncEnumerable().FirstOrDefaultAsync(x => x.Value.Count == 0)).Key ?? throw new ArgumentException($"Cyclic dependencies are not allowed!{Environment.NewLine}" + - $"Sorted: {string.Join(", ", nodes.Select(identifier).ToEnumerable().Except(dependencies.Keys.Select(identifier)))}{Environment.NewLine}" + + $"Sorted: {string.Join(", ", nodes.Select(identifier).Except(dependencies.Keys.Select(identifier).ToAsyncEnumerable()))}{Environment.NewLine}" + $"Unsorted:{Environment.NewLine}" + $" {string.Join($"{Environment.NewLine} ", dependencies.Select(element => $"{identifier(element.Key)}:{Environment.NewLine} {string.Join($"{Environment.NewLine} ", element.Value)}"))}"); @@ -43,26 +45,23 @@ public static async IAsyncEnumerable FindCycles(this } } - /// - /// Performs a topological sort of the input , given an expression that produces a set of connected nodes. - /// - /// The input nodes. - /// The expression producing connected nodes. - /// The node type. - /// The input nodes, sorted. - /// Thrown if a cyclic dependency is found. + /// public static IAsyncEnumerable TopologicalSort(this IAsyncEnumerable nodes, Func> connected) - where TNode : notnull => nodes.TopologicalSort(node => node, connected); + where TNode : notnull + => nodes.TopologicalSort(node => node, connected); /// /// Performs a topological sort of the input , given an expression that produces a set of connected nodes. /// + /// + /// Note that this method requires a full evaluation of the input sequence to produce an output. + /// /// The input nodes. /// Gets the dependency identifier of a node. /// The expression producing connected nodes. /// The node type. /// The dependency connection type. - /// The input nodes, sorted . + /// The input nodes, sorted. /// Thrown if a cyclic dependency is found. public static async IAsyncEnumerable TopologicalSort(this IAsyncEnumerable nodes, Func identifier, Func> connected) where TNode : notnull @@ -72,9 +71,9 @@ public static async IAsyncEnumerable TopologicalSort( while (elements.Count > 0) { - var key = elements.FirstOrDefault(x => x.Value.Count == 0).Key + var key = (await elements.ToAsyncEnumerable().FirstOrDefaultAsync(x => x.Value.Count == 0)).Key ?? throw new ArgumentException($"Cyclic dependencies are not allowed!{Environment.NewLine}" + - $"Sorted: {string.Join(", ", nodes.Select(identifier).ToEnumerable().Except(elements.Keys.Select(identifier)))}{Environment.NewLine}" + + $"Sorted: {string.Join(", ", nodes.Select(identifier).Except(elements.Keys.Select(identifier).ToAsyncEnumerable()))}{Environment.NewLine}" + $"Unsorted:{Environment.NewLine}" + $" {string.Join($"{Environment.NewLine} ", elements.Select(element => $"{identifier(element.Key)}:{Environment.NewLine} {string.Join($"{Environment.NewLine} ", element.Value)}"))}"); diff --git a/EnumerableToolkit.Async/EnumerableToolkit.Async.csproj b/EnumerableToolkit.Async/EnumerableToolkit.Async.csproj index 087c7f4..eb15ede 100644 --- a/EnumerableToolkit.Async/EnumerableToolkit.Async.csproj +++ b/EnumerableToolkit.Async/EnumerableToolkit.Async.csproj @@ -1,20 +1,10 @@  - - - True + EnumerableToolkit $(AssemblyTitle) - Banane9 1.2.0 Contains helpful convenience methods to work with async enumerables. - README.md - https://github.com/Banane9/EnumerableToolkit - $(PackageProjectUrl).git - - IEnumerable; enumerable; tool; tools; toolkit; builder; helper; linq; async + $(PackageTags); IAsyncEnumerable; async @@ -22,12 +12,8 @@ - - - + diff --git a/EnumerableToolkit.Builder.Async/EnumerableToolkit.Builder.Async.csproj b/EnumerableToolkit.Builder.Async/EnumerableToolkit.Builder.Async.csproj index e2799fe..a3250c7 100644 --- a/EnumerableToolkit.Builder.Async/EnumerableToolkit.Builder.Async.csproj +++ b/EnumerableToolkit.Builder.Async/EnumerableToolkit.Builder.Async.csproj @@ -1,20 +1,10 @@  - EnumerableToolkit.Builder - - - - True + EnumerableToolkit.Builder $(AssemblyTitle) - Banane9 2.0.2 Adds an AsyncEnumerableBuilder to incrementally construct an async enumerable sequence out of building blocks. - README.md - https://github.com/Banane9/EnumerableToolkit - $(PackageProjectUrl).git - - IAsyncEnumerable; enumerable; tool; tools; toolkit; builder; helper; linq; async + $(PackageTags); IAsyncEnumerable; builder; async @@ -22,10 +12,6 @@ - - - - diff --git a/EnumerableToolkit.Builder/EnumerableToolkit.Builder.csproj b/EnumerableToolkit.Builder/EnumerableToolkit.Builder.csproj index eb42997..b186571 100644 --- a/EnumerableToolkit.Builder/EnumerableToolkit.Builder.csproj +++ b/EnumerableToolkit.Builder/EnumerableToolkit.Builder.csproj @@ -2,15 +2,9 @@ True $(AssemblyTitle) - Banane9 2.0.2 Adds an EnumerableBuilder to incrementally construct an enumerable sequence out of building blocks. - README.md - https://github.com/Banane9/EnumerableToolkit - $(PackageProjectUrl).git - - IEnumerable; enumerable; tool; tools; toolkit; builder; helper; linq + $(PackageTags); builder diff --git a/EnumerableToolkit.Tests/AssemblyAttributes.cs b/EnumerableToolkit.Tests/AssemblyAttributes.cs new file mode 100644 index 0000000..8b7de71 --- /dev/null +++ b/EnumerableToolkit.Tests/AssemblyAttributes.cs @@ -0,0 +1 @@ +[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] \ No newline at end of file diff --git a/EnumerableToolkit.Tests/EnumerableToolkit.Tests.csproj b/EnumerableToolkit.Tests/EnumerableToolkit.Tests.csproj index 25ea97c..3f0fd29 100644 --- a/EnumerableToolkit.Tests/EnumerableToolkit.Tests.csproj +++ b/EnumerableToolkit.Tests/EnumerableToolkit.Tests.csproj @@ -1,19 +1,24 @@ - net8.0 + net48;net8.0;net10.0 enable enable false true + false + false - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + @@ -26,5 +31,4 @@ - diff --git a/EnumerableToolkit.sln b/EnumerableToolkit.sln index 4d02a97..e61c95b 100644 --- a/EnumerableToolkit.sln +++ b/EnumerableToolkit.sln @@ -18,6 +18,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EnumerableToolkit.Builder.A EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnumerableToolkit.Tests", "EnumerableToolkit.Tests\EnumerableToolkit.Tests.csproj", "{0516AF95-0995-4C80-8F81-A5600D21D4D0}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}" + ProjectSection(SolutionItems) = preProject + .github\workflows\build.yml = .github\workflows\build.yml + .github\workflows\publish.yml = .github\workflows\publish.yml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -48,6 +54,9 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {5C6DBB92-7E98-4D41-B8DF-540417285AD4} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {95A463BB-A248-4C31-A626-A45EAB2A9F09} EndGlobalSection diff --git a/EnumerableToolkit/EnumerableToolkit.csproj b/EnumerableToolkit/EnumerableToolkit.csproj index bae66b5..2fa7080 100644 --- a/EnumerableToolkit/EnumerableToolkit.csproj +++ b/EnumerableToolkit/EnumerableToolkit.csproj @@ -1,16 +1,8 @@  - True $(AssemblyTitle) - Banane9 1.3.1 Contains helpful convenience methods to work with enumerables and some more specific types. - README.md - https://github.com/Banane9/EnumerableToolkit - $(PackageProjectUrl).git - - IEnumerable; enumerable; tool; tools; toolkit; builder; helper; linq