Skip to content

Allow GenAPI to include additional API - #12

Closed
mthalman wants to merge 1 commit into
demo/54528-basefrom
demo/54528-head
Closed

mthalman wants to merge 1 commit into
demo/54528-basefrom
demo/54528-head

Conversation

@mthalman

Copy link
Copy Markdown
Owner

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-file and --exclude-internal-compiler-attributes options (plus MSBuild/task plumbing) to control extra API emission.
  • Extend SymbolFilterFactory to 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
};
@mthalman mthalman closed this Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants