Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rgen] Add a factory method to create the aux variable for a BindFrom(typeof(NSValue)). #22112

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

mandel-macaque
Copy link
Member

@mandel-macaque mandel-macaque commented Feb 5, 2025

This change allows to be able to generate an aux variable that will be needed if a customer defined a export method in the following way:

[Export<Method> ()]
public virtual partial void MyMethod ([BindFrom (typeof (NSValue))] CGPoint point);

The above binding API indicates that the native method in objc will take a NSValue but we want to expose our users a CGPoint. In order to send a NSValue to objc, we need to declare an aux variable that will be used for the native method invocation.

Copy link
Contributor

github-actions bot commented Feb 5, 2025

⚠️ Your code has been reformatted. ⚠️

If this is not desired, add the actions-disable-autoformat label, and revert the reformatting commit.

If files unrelated to your change were modified, try reverting the reformatting commit + merging with the target branch (and push those changes).

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 413d39c183b9b6d2763fe6bb9fbae1dc33204959 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 413d39c183b9b6d2763fe6bb9fbae1dc33204959 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 413d39c183b9b6d2763fe6bb9fbae1dc33204959 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Monterey (12) passed 💻

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

Pipeline on Agent
Hash: 413d39c183b9b6d2763fe6bb9fbae1dc33204959 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Ventura (13) passed 💻

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

Pipeline on Agent
Hash: 413d39c183b9b6d2763fe6bb9fbae1dc33204959 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

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

Pipeline on Agent
Hash: 413d39c183b9b6d2763fe6bb9fbae1dc33204959 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻

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

Pipeline on Agent
Hash: 413d39c183b9b6d2763fe6bb9fbae1dc33204959 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

.NET ( No breaking changes )

❗ API diff vs stable (Breaking changes)

.NET ( ❗ Breaking changes ❗ )

ℹ️ Generator diff

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

Pipeline on Agent
Hash: 413d39c183b9b6d2763fe6bb9fbae1dc33204959 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: 413d39c183b9b6d2763fe6bb9fbae1dc33204959 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 112 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 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 8 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 8 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 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: 413d39c183b9b6d2763fe6bb9fbae1dc33204959 [PR build]

var t = parameter.Type.Name;

// get the factory method based on the parameter type, if it is not found, return null
var factoryMethod = parameter.Type switch { { FullyQualifiedName: "CoreGraphics.CGAffineTransform" } => "FromCGAffineTransform", { FullyQualifiedName: "Foundation.NSRange" } => "FromRange", { FullyQualifiedName: "CoreGraphics.CGVector" } => "FromCGVector", { FullyQualifiedName: "SceneKit.SCNMatrix4" } => "FromSCNMatrix4", { FullyQualifiedName: "CoreLocation.CLLocationCoordinate2D" } => "FromMKCoordinate", { FullyQualifiedName: "SceneKit.SCNVector3" } => "FromVector", { FullyQualifiedName: "SceneKit.SCNVector4" } => "FromVector", { FullyQualifiedName: "CoreGraphics.CGPoint" } => "FromCGPoint", { FullyQualifiedName: "CoreGraphics.CGRect" } => "FromCGRect", { FullyQualifiedName: "CoreGraphics.CGSize" } => "FromCGSize", { FullyQualifiedName: "UIKit.UIEdgeInsets" } => "FromUIEdgeInsets", { FullyQualifiedName: "UIKit.UIOffset" } => "FromUIOffset", { FullyQualifiedName: "MapKit.MKCoordinateSpan" } => "FromMKCoordinateSpan", { FullyQualifiedName: "CoreMedia.CMTimeRange" } => "FromCMTimeRange", { FullyQualifiedName: "CoreMedia.CMTime" } => "FromCMTime", { FullyQualifiedName: "CoreMedia.CMTimeMapping" } => "FromCMTimeMapping", { FullyQualifiedName: "CoreAnimation.CATransform3D" } => "FromCATransform3D",
Copy link
Contributor

Choose a reason for hiding this comment

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

split in multi lines ?

Copy link
Member Author

@mandel-macaque mandel-macaque Feb 5, 2025

Choose a reason for hiding this comment

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

Ugh, that was the formatter we use :/ It was in multiple lines. Thanks for catching that. If you notice I have a pragma in other method to stop it from doing it

Base automatically changed from dev/mandel/aux-variable-nsnumber-bindfrom to main February 5, 2025 11:38
@mandel-macaque mandel-macaque force-pushed the dev/mandel/aux-variable-nsvalue-bindfrom branch from 413d39c to 2144ab7 Compare February 5, 2025 11:49
@mandel-macaque
Copy link
Member Author

Failing tests are unrelated to the change.

@mandel-macaque mandel-macaque merged commit fe3580e into main Feb 5, 2025
44 of 47 checks passed
@mandel-macaque mandel-macaque deleted the dev/mandel/aux-variable-nsvalue-bindfrom branch February 5, 2025 19:00
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.

4 participants