From 458d5ff4ac4ae2e67d0efbc2f8eabe7344dfef4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Luthi?= Date: Sat, 11 Nov 2023 10:59:57 +0100 Subject: [PATCH] Use the PolySharp package for polyfills [PolySharp][1] provides generated, source-only polyfills for C# language features, to easily use all runtime-agnostic features downlevel. This replaces the need for the `Nullable` package and we can get rid of the manually added `IsExternalInit` polyfill. Also, while I was touching the csproj and props file I standardised the way to import dev dependencies with the PrivateAssets="all" attribute. [1]: https://github.com/Sergio0694/PolySharp/ --- src/Directory.Build.props | 19 +++++++------- .../Spectre.Console.Cli.csproj | 26 ++++++++----------- .../Internal/Polyfill/IsExternalInit.cs | 15 ----------- src/Spectre.Console/Spectre.Console.csproj | 9 +------ .../Spectre.Console.Cli.Tests.csproj | 1 - .../Spectre.Console.Tests.csproj | 1 - 6 files changed, 22 insertions(+), 49 deletions(-) delete mode 100644 src/Spectre.Console/Internal/Polyfill/IsExternalInit.cs diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 6bf853f6b..bd2d6a2fe 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -30,15 +30,16 @@ true true - + + + true + + - - - - All - - - All - + + + + + \ No newline at end of file diff --git a/src/Spectre.Console.Cli/Spectre.Console.Cli.csproj b/src/Spectre.Console.Cli/Spectre.Console.Cli.csproj index 79efdf64f..6dde0bbbe 100644 --- a/src/Spectre.Console.Cli/Spectre.Console.Cli.csproj +++ b/src/Spectre.Console.Cli/Spectre.Console.Cli.csproj @@ -25,25 +25,21 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - True - True - HelpProvider.resx - + + + True + True + HelpProvider.resx + - - - ResXFileCodeGenerator - HelpProvider.Designer.cs - + + + ResXFileCodeGenerator + HelpProvider.Designer.cs + diff --git a/src/Spectre.Console/Internal/Polyfill/IsExternalInit.cs b/src/Spectre.Console/Internal/Polyfill/IsExternalInit.cs deleted file mode 100644 index e152620ce..000000000 --- a/src/Spectre.Console/Internal/Polyfill/IsExternalInit.cs +++ /dev/null @@ -1,15 +0,0 @@ -#if NETSTANDARD2_0 -using System.ComponentModel; - -namespace System.Runtime.CompilerServices -{ - /// - /// Reserved to be used by the compiler for tracking metadata. - /// This class should not be used by developers in source code. - /// - [EditorBrowsable(EditorBrowsableState.Never)] - internal static class IsExternalInit - { - } -} -#endif \ No newline at end of file diff --git a/src/Spectre.Console/Spectre.Console.csproj b/src/Spectre.Console/Spectre.Console.csproj index fdecc8286..aebd34c41 100644 --- a/src/Spectre.Console/Spectre.Console.csproj +++ b/src/Spectre.Console/Spectre.Console.csproj @@ -17,9 +17,7 @@ - - all - + @@ -30,13 +28,8 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - $(DefineConstants)TRACE;WCWIDTH_VISIBILITY_INTERNAL diff --git a/test/Spectre.Console.Cli.Tests/Spectre.Console.Cli.Tests.csproj b/test/Spectre.Console.Cli.Tests/Spectre.Console.Cli.Tests.csproj index 6f6843471..2429a714e 100644 --- a/test/Spectre.Console.Cli.Tests/Spectre.Console.Cli.Tests.csproj +++ b/test/Spectre.Console.Cli.Tests/Spectre.Console.Cli.Tests.csproj @@ -9,7 +9,6 @@ - diff --git a/test/Spectre.Console.Tests/Spectre.Console.Tests.csproj b/test/Spectre.Console.Tests/Spectre.Console.Tests.csproj index e01a0f5f7..9679e4339 100644 --- a/test/Spectre.Console.Tests/Spectre.Console.Tests.csproj +++ b/test/Spectre.Console.Tests/Spectre.Console.Tests.csproj @@ -18,7 +18,6 @@ -