chore(191): lock v1.0 public API surface (PublicApiAnalyzers)#210
Merged
Conversation
Add Microsoft.CodeAnalysis.PublicApiAnalyzers (5.6.0) plus a complete PublicAPI.Shipped.txt baseline to the reusable, externally-consumable library projects (Providers.Abstractions, Core, Ide.Core, Tasks, Cli), so future accidental public-surface changes fail the build (RS0016/ RS0017) under TreatWarningsAsErrors instead of shipping silently. For the net472;net8.0;net9.0;net10.0 multi-targeted projects, the analyzer + AdditionalFiles are scoped to net10.0 only via the new build/PublicApi.props (opted into per-project, not via Directory.Build.props) - this avoids a per-TFM baseline that would otherwise churn on net472's polyfilled/looser-nullable surface while still locking the real cross-consumer API once. Baselines were generated mechanically: build each project with the analyzer active, collect every RS0016 diagnostic's reported symbol, and populate PublicAPI.Unshipped.txt, then move that into PublicAPI.Shipped.txt for the v1.0-locked baseline.
Contributor
Code Coverage |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #210 +/- ##
==========================================
+ Coverage 84.93% 92.19% +7.26%
==========================================
Files 93 93
Lines 4832 4832
Branches 746 746
==========================================
+ Hits 4104 4455 +351
+ Misses 429 377 -52
+ Partials 299 0 -299
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Microsoft.CodeAnalysis.PublicApiAnalyzers(5.6.0) + a completePublicAPI.Shipped.txtbaseline to the reusable, externally-consumable library projects:JD.Efcpt.Build.Providers.Abstractions,JD.Efcpt.Build.Core,JD.Efcpt.Ide.Core,JD.Efcpt.Build.Tasks, andJD.Efcpt.Cli.build/PublicApi.propsis explicitly imported per-project (not viaDirectory.Build.props), so only these five projects opt into the analyzer.net472;net8.0;net9.0;net10.0multi-targeted projects (Providers.Abstractions, Core, Tasks), the analyzer +AdditionalFilesare scoped to net10.0 only via aPublicApiAnalyzerTfmproperty, avoiding a per-TFM baseline that would otherwise churn on net472's polyfilled types / looser nullable annotations, while still locking the real cross-consumer surface once.Ide.Core(netstandard2.0) andCli(net8.0) are single-TFM, so the props apply unconditionally.RS0016diagnostic's reported symbol from the build log, and populatePublicAPI.Unshipped.txt, then move that intoPublicAPI.Shipped.txtas the v1.0-locked baseline (leavingUnshipped.txtwith just the#nullable enableheader).dotnet build JD.Efcpt.Build.sln -c Releaseand-c Debugboth succeed with 0 errors underTreatWarningsAsErrors=true, across all TFMs.StringExtensionsin Providers.Abstractions and rebuilt - it producederror RS0016: Symbol '...SanityCheckUnlistedMember...' is not part of the declared public API, failing the build. Reverted before committing.JD.Efcpt.Build.Tasks(831-member baseline) andJD.Efcpt.Cli(21-member baseline) were both included per the task's "attempt if it generates cleanly" guidance - both built clean on the first mechanical pass.packages.lock.jsondiffs (src/JD.Efcpt.Build,tests/JD.Efcpt.Build.Tests) that a full-solution restore regenerates onmaineven without any of this PR's changes (pre-existing drift, confirmed by stashing and re-restoring on a clean checkout) - out of scope for v1.0 readiness checklist — converge on production-grade stability #191.CLAUDE.mdexists anywhere in this repo, so the net10.0-scoping rationale is documented directly inbuild/PublicApi.propsand in each importing.csprojvia inline comments instead.Test plan
dotnet build JD.Efcpt.Build.sln -c Release- 0 errors, 6 pre-existing unrelated TFM-support warnings onlydotnet build JD.Efcpt.Build.sln -c Debug- 0 errorsdotnet test JD.Efcpt.Build.sln --filter "Category!=Integration"- 1233/1233 passed, 0 failedPart of #191 (v1.0 readiness).