dotnet / docfx

Static site generator for .NET API documentation.
https://dotnet.github.io/docfx/
MIT License
4.03k stars 858 forks source link

chore: Add PolySharp libarary to use latest C# syntax #9960

Closed filzrev closed 4 months ago

filzrev commented 4 months ago

This PR add PolySharp package reference to projects.

Background

Currently docfx use multi target frameworks net6 and net8. So some latest C# feature usage is limited. (e.g. required modifier)

By this changes. It can use latest C# 12 features when targeting .NET 6 runtime.
And it can remove #ifdef from metadata generation when using markdown/apiPage output format.


PolySharp generate source-only polyfills. So runtime library dependency is not needed. The only concern is the increase of build time due to running source generator. But it's acceptable increase rate.

CI build time

OS Original This PR CI
Windows 10m18s 9m2s
Ubuntu 11m10s 12m12s
macOS 6m 33s 6m41s
codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 78.93%. Comparing base (fe673ec) to head (a30ee2d). Report is 176 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #9960 +/- ## ========================================== + Coverage 74.31% 78.93% +4.61% ========================================== Files 536 540 +4 Lines 23189 23376 +187 Branches 4056 4052 -4 ========================================== + Hits 17234 18451 +1217 + Misses 4853 3791 -1062 - Partials 1102 1134 +32 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.