Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the GenAPI compatibility tooling to support including additional APIs that would otherwise be filtered out by accessibility (notably internal/out-of-band compiler attributes), via a new “additional inclusion” filter path. It wires this through the GenAPI CLI/MSBuild task surface and adds targeted GenAPI output tests for inclusion-filter behavior.
Changes:
- Add
--include-api-fileand--exclude-internal-compiler-attributesoptions (plus MSBuild/task plumbing) to control extra API emission. - Extend
SymbolFilterFactoryto optionally keep symbols that are either accessible or explicitly included. - Add DocId-based “include mode” and composite OR behavior, plus new GenAPI tests for internal OOB attribute emission when explicitly included.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/Microsoft.DotNet.GenAPI.Tests/CSharpFileBuilderTests.cs | Adds tests and hooks to pass an additional API inclusion filter through output generation helpers. |
| src/Compatibility/Microsoft.DotNet.ApiSymbolExtensions/Filtering/SymbolFilterFactory.cs | Adds an optional additionalApiInclusionFilter and combines it with accessibility via OR to keep explicitly-included symbols. |
| src/Compatibility/Microsoft.DotNet.ApiSymbolExtensions/Filtering/DocIdSymbolFilter.cs | Adds “include mode” behavior (include-only vs exclude) and updates factory methods accordingly. |
| src/Compatibility/Microsoft.DotNet.ApiSymbolExtensions/Filtering/CompositeSymbolFilter.cs | Introduces AND/OR combination mode for composing filters. |
| src/Compatibility/GenAPI/Microsoft.DotNet.GenAPI/GenAPIOptions.cs | Adds options to specify include-api files and to opt out of emitting internal compiler attributes. |
| src/Compatibility/GenAPI/Microsoft.DotNet.GenAPI/GenAPIApp.cs | Builds an additional inclusion filter (include files + curated compiler attribute DocIDs) and passes it into filter factory. |
| src/Compatibility/GenAPI/Microsoft.DotNet.GenAPI.Tool/Program.cs | Adds new CLI options and passes them through to GenAPIOptions. |
| src/Compatibility/GenAPI/Microsoft.DotNet.GenAPI.Task/GenAPITask.cs | Adds new task parameters and forwards them to GenAPIApp. |
| src/Compatibility/GenAPI/Microsoft.DotNet.GenAPI.Task/build/Microsoft.DotNet.GenAPI.Task.targets | Wires MSBuild properties/items into the GenAPI MSBuild task invocation. |
Comment on lines
+14
to
16
| public sealed class CompositeSymbolFilter(CompositeSymbolFilterMode mode = CompositeSymbolFilterMode.And, | ||
| params IEnumerable<ISymbolFilter> filters) : ISymbolFilter | ||
| { |
Comment on lines
+24
to
25
| public static DocIdSymbolFilter CreateFromFiles(string[] filesWithDocIds, bool includeDocIds = false) | ||
| { |
Comment on lines
+53
to
+65
| Option<string[]?> includeApiFilesOption = new("--include-api-file") | ||
| { | ||
| Description = "The path to one or more api inclusion files with types in DocId format. APIs listed in these files are emitted even if they would otherwise be filtered out.", | ||
| CustomParser = ParseAssemblyArgument, | ||
| Arity = ArgumentArity.ZeroOrMore, | ||
| Recursive = true | ||
| }; | ||
|
|
||
| Option<bool> excludeInternalCompilerAttributesOption = new("--exclude-internal-compiler-attributes") | ||
| { | ||
| Description = "If true, opts out of emitting the curated set of internal compiler attributes (e.g. IsExternalInit) that are emitted by default.", | ||
| Recursive = true | ||
| }; |
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.
Faithful reproduction of dotnet#54528 (
Allow GenAPI to include additional API) at the exact commit Copilot reviewed (fa0a7ba), for a default-vs-skill code-review comparison. The base branch carries the code-review skill so Copilot auto-loads it.