Skip to content

Commit

Permalink
Use the PolySharp package for polyfills
Browse files Browse the repository at this point in the history
[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/
  • Loading branch information
0xced committed Nov 11, 2023
1 parent 250b1f4 commit 3b1c74c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 49 deletions.
19 changes: 10 additions & 9 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>


<PropertyGroup Label="PolySharp">
<PolySharpExcludeTypeForwardedToDeclarations>true</PolySharpExcludeTypeForwardedToDeclarations>
</PropertyGroup>

<ItemGroup Label="Package References">
<PackageReference Include="MinVer" PrivateAssets="All" Version="4.2.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" Version="1.1.1" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Roslynator.Analyzers" Version="4.1.2">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="MinVer" PrivateAssets="all" Version="4.2.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="all" Version="1.1.1" />
<PackageReference Include="PolySharp" Version="1.13.2" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="4.1.2" PrivateAssets="all" />
</ItemGroup>
</Project>
26 changes: 11 additions & 15 deletions src/Spectre.Console.Cli/Spectre.Console.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,21 @@
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.160" PrivateAssets="all" />
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[$(AnnotatedReferenceAssemblyVersion)]" />
<PackageReference Include="Nullable" Version="1.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<Compile Update="Resources\HelpProvider.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>HelpProvider.resx</DependentUpon>
</Compile>
<ItemGroup>
<Compile Update="Resources\HelpProvider.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>HelpProvider.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Resources\HelpProvider.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>HelpProvider.Designer.cs</LastGenOutput>
</EmbeddedResource>
<ItemGroup>
<EmbeddedResource Update="Resources\HelpProvider.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>HelpProvider.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

</Project>
15 changes: 0 additions & 15 deletions src/Spectre.Console/Internal/Polyfill/IsExternalInit.cs

This file was deleted.

9 changes: 1 addition & 8 deletions src/Spectre.Console/Spectre.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="Wcwidth.Sources" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Wcwidth.Sources" Version="1.0.0" PrivateAssets="all" />
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
Expand All @@ -30,13 +28,8 @@
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.160" PrivateAssets="all" />
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[$(AnnotatedReferenceAssemblyVersion)]" />
<PackageReference Include="Nullable" Version="1.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>


<PropertyGroup>
<DefineConstants>$(DefineConstants)TRACE;WCWIDTH_VISIBILITY_INTERNAL</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="IsExternalInit" Version="1.0.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.6.1" />
Expand Down
1 change: 0 additions & 1 deletion test/Spectre.Console.Tests/Spectre.Console.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="IsExternalInit" Version="1.0.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.6.1" />
Expand Down

0 comments on commit 3b1c74c

Please sign in to comment.