Skip to content

[sharpie] Add --deepsplit option to split bindings into one file per source header#24883

Merged
dalexsoto merged 4 commits intomainfrom
dev/alex/sharpie-deepsplit
Mar 16, 2026
Merged

[sharpie] Add --deepsplit option to split bindings into one file per source header#24883
dalexsoto merged 4 commits intomainfrom
dev/alex/sharpie-deepsplit

Conversation

@dalexsoto
Copy link
Copy Markdown
Member

@dalexsoto dalexsoto commented Mar 12, 2026

Add a new --deepsplit CLI option that generates one .cs file per source header instead of a single ApiDefinition.cs. This makes it easier to navigate large framework bindings and map generated C# types back to their original Objective-C headers.

The implementation adds a DeepSplitMassager that extracts the source header filename from each declaration's Clang annotation via Cursor.TryGetPresumedLoc, creates a DocumentSyntaxTree per unique header basename, and distributes declarations accordingly. Struct and enum declarations are consolidated in StructsAndEnums.cs. Declarations without source location info fall back to ApiDefinition.cs.

Example: binding FBSDKCoreKit with --deepsplit produces 194 files (FBSDKAccessToken.cs, FBSDKGraphRequest.cs, etc.) instead of a single 7,688-line ApiDefinition.cs.

Fixes #23024.

…source header

Add a new --deepsplit CLI option that generates one .cs file per source
header instead of a single ApiDefinition.cs. This makes it easier to
navigate large framework bindings and map generated C# types back to
their original Objective-C headers.

The implementation adds a DeepSplitMassager that extracts the source
header filename from each declaration's Clang annotation via
Cursor.TryGetPresumedLoc, creates a DocumentSyntaxTree per unique
header basename, and distributes declarations accordingly.
Struct and enum declarations are consolidated in StructsAndEnums.cs.
Declarations without source location info fall back to ApiDefinition.cs.

Example: binding FBSDKCoreKit with --deepsplit produces 194 files
(FBSDKAccessToken.cs, FBSDKGraphRequest.cs, etc.) instead of a single
7,688-line ApiDefinition.cs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dalexsoto dalexsoto requested a review from rolfbjarne March 12, 2026 07:09
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

1 similar comment
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@dalexsoto
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Resolve merge conflicts in ObjectiveCClass.cs where both the
Scope_* tests (from main) and DeepSplit_* tests (from this branch)
were added at the end of the file. Both test sets are preserved.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #16a4b0d] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 16a4b0df65bf3eefbc0fbfdfd6ddda40b279d1aa [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #16a4b0d] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 16a4b0df65bf3eefbc0fbfdfd6ddda40b279d1aa [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 16a4b0df65bf3eefbc0fbfdfd6ddda40b279d1aa [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #16a4b0d] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 16a4b0df65bf3eefbc0fbfdfd6ddda40b279d1aa [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🚀 [CI Build #16a4b0d] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 156 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 11 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 16a4b0df65bf3eefbc0fbfdfd6ddda40b279d1aa [PR build]

@dalexsoto dalexsoto merged commit 95470ee into main Mar 16, 2026
48 checks passed
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.

Enhance sharpie to enable it generates cs file as split api definition files

3 participants