Skip to content

[tools] Add sharpie. Fixes #23962.#24622

Merged
rolfbjarne merged 32 commits intomainfrom
dev/rolf/sharpie
Feb 16, 2026
Merged

[tools] Add sharpie. Fixes #23962.#24622
rolfbjarne merged 32 commits intomainfrom
dev/rolf/sharpie

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

@rolfbjarne rolfbjarne commented Feb 4, 2026

Open-source the Objective-Sharpie tool.

  • Port the old closed-source version of Objective-Sharpie to modern .NET, and have it use ClangSharp for its clang integration.
  • This is a simplified port, any features that were not frequently used have been dropped. In particular, only two features remain:
    • Binding an entire OS SDK (which we use for our own bindings).
  • Binding a .framework (to bind third-party bindings).
  • The new sharpie will be distributed as a .NET command-line tool.

Fixes #23962.
Fixes #21573.

Open-source the Objective-Sharpie tool.

* Port the old closed-source version of Objective-Sharpie to modern .NET, and have it use ClangSharp for its clang integration.
* This is a simplified port, any features that were not frequently used have been dropped. In particular, only two features remain:
    * Binding an entire OS SDK (which we use for our own bindings).
	* Binding a .framework (to bind third-party bindings).
* The new sharpie will be distributed as a .NET command-line tool.

Fixes #23962.
@rolfbjarne rolfbjarne requested a review from Copilot February 4, 2026 11:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 open-sources the Objective-Sharpie tool by porting it to modern .NET with ClangSharp integration. The tool generates C# bindings from Objective-C APIs, supporting SDK binding and framework binding workflows. It will be distributed as a .NET command-line tool.

Changes:

  • Ports Objective-Sharpie from closed-source to open-source using ClangSharp for clang integration
  • Implements core binding infrastructure including massagers, attributes, and type system
  • Adds comprehensive test suite with test cases for various binding scenarios

Reviewed changes

Copilot reviewed 299 out of 619 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/sharpie/Sharpie.Bind/*.cs Core binding logic including massagers, type system, and attribute definitions
tools/sharpie/Sharpie.Bind.Tool/*.cs Command-line tool entry point and configuration
tests/sharpie/Tests/**/*.h Test header files for binding scenarios
tests/sharpie/Tests/**/*.cs Expected C# output for test cases
tests/xtro-sharpie/**/*.cs Updates to xtro-sharpie tool to use new ClangSharp-based binding system
tools/common/ProductConstants.in.cs Added SharpieVersion constant
Files not reviewed (1)
  • tools/sharpie/Sharpie.Bind/Resources.designer.cs: Language not supported

Comment thread tools/sharpie/Sharpie.Bind/Massagers/NamespaceMassager.cs Outdated
Comment thread tools/sharpie/Sharpie.Bind/NRefactoryExtensions.cs
Comment thread tools/sharpie/Sharpie.Bind/StringExtensions.cs
@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.

@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.

Copy link
Copy Markdown
Member

@dalexsoto dalexsoto left a comment

Choose a reason for hiding this comment

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

Looking good!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 4, 2026

@rolfbjarne I've opened a new pull request, #24625, to work on those changes. Once the pull request is ready, I'll request review from you.

@vs-mobiletools-engineering-service2

This comment has been minimized.

5 similar comments
@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.

@rolfbjarne rolfbjarne enabled auto-merge (squash) February 13, 2026 14:46
@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 #09205e8] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 09205e81ce8b96dc3eeef3f57c5d74e9dee24352 [PR build]

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

✅ [CI Build #09205e8] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 09205e81ce8b96dc3eeef3f57c5d74e9dee24352 [PR build]

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

💻 [CI Build #09205e8] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 09205e81ce8b96dc3eeef3f57c5d74e9dee24352 [PR build]

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

💻 [CI Build #09205e8] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 09205e81ce8b96dc3eeef3f57c5d74e9dee24352 [PR build]

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

💻 [CI Build #09205e8] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 09205e81ce8b96dc3eeef3f57c5d74e9dee24352 [PR build]

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

💻 [CI Build #09205e8] Tests on macOS arm64 - Mac Tahoe (26) passed 💻

All tests on macOS arm64 - Mac Tahoe (26) passed.

Pipeline on Agent
Hash: 09205e81ce8b96dc3eeef3f57c5d74e9dee24352 [PR build]

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

💻 [CI Build #09205e8] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 09205e81ce8b96dc3eeef3f57c5d74e9dee24352 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

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

✅ [PR Build #09205e8] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 09205e81ce8b96dc3eeef3f57c5d74e9dee24352 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@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: 09205e81ce8b96dc3eeef3f57c5d74e9dee24352 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

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

🚀 [CI Build #09205e8] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 131 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. [attempt 4] Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. [attempt 4] Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. [attempt 4] 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. [attempt 4] 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

Pipeline on Agent
Hash: 09205e81ce8b96dc3eeef3f57c5d74e9dee24352 [PR build]

@rolfbjarne rolfbjarne merged commit 73ebf5a into main Feb 16, 2026
48 checks passed
@beeradmoore
Copy link
Copy Markdown

@rolfbjarne , is there any ETA/plans for when sharpie should be released as a dotnet tool. Where is the best place to follow/monitor to hear when it is out?

@cho-trackman
Copy link
Copy Markdown

Nice to see this :)

Is there no way to run this on x86 (build agents in Azure DevOps)? We currently run Sharpie as a part of our CI build, but we don't have access to ARM agents yet.

@rolfbjarne
Copy link
Copy Markdown
Member Author

@rolfbjarne , is there any ETA/plans for when sharpie should be released as a dotnet tool. Where is the best place to follow/monitor to hear when it is out?

We'll try to publish something shortly.

I'll post something here with instructions: #23964

@rolfbjarne
Copy link
Copy Markdown
Member Author

Is there no way to run this on x86 (build agents in Azure DevOps)? We currently run Sharpie as a part of our CI build, but we don't have access to ARM agents yet.

No, we depend on https://github.com/dotnet/clangsharp/, which is arm64 only on macOS.

One potential idea could be to create a NuGet from your native framework, and build that locally and reference to the NuGet in your main project. That way you won't have to run sharpie as part of a CI build.

@cho-trackman
Copy link
Copy Markdown

Is there no way to run this on x86 (build agents in Azure DevOps)? We currently run Sharpie as a part of our CI build, but we don't have access to ARM agents yet.

No, we depend on https://github.com/dotnet/clangsharp/, which is arm64 only on macOS.

One potential idea could be to create a NuGet from your native framework, and build that locally and reference to the NuGet in your main project. That way you won't have to run sharpie as part of a CI build.

Yeah, you are right, that is the solution. Right now we are doing it in CI as a kind of validation, but it's not really needed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

objective-sharpie Issues or pull requests affecting Objective Sharpie.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade sharpie to use .NET instead of Mono Port xtro to use .NET instead of Mono

7 participants