-
Notifications
You must be signed in to change notification settings - Fork 543
[RGen] Add ARKit trampoline tests. #22927
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
base: main
Are you sure you want to change the base?
Conversation
This is the initial implementation of the trampoline emitter. It just focuses on the delegate and the static class. A generic class has been added but more tests will come per framework, we simply want to make the diff manageable for the team, so we have not added all the tests in a single PR.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add the tests that show that the ARKit trampoline static class is correctly generated.
// Generate trampolines for compilation | ||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::ARKit.GetGeolocationCallback))] | ||
unsafe internal delegate void DGetGeolocationCallback (global::System.IntPtr block_ptr, global::CoreLocation.CLLocationCoordinate2D coordinate, double altitude, global::ObjCRuntime.NativeHandle error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generates the following code:
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
[UserDelegateType (typeof (global::ARKit.GetGeolocationCallback))]
unsafe internal delegate void DGetGeolocationCallback (IntPtr block, global::CoreLocation.CLLocationCoordinate2D coordinate, double altitude, NativeHandle error);
internal static unsafe void Invoke (global::System.IntPtr block_ptr, global::CoreLocation.CLLocationCoordinate2D coordinate, double altitude, global::ObjCRuntime.NativeHandle error) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::ARKit.GetGeolocationCallback> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (coordinate, altitude, global::ObjCRuntime.Runtime.GetNSObject<global::Foundation.NSError> (error)!); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generates the following code:
internal static unsafe void Invoke (IntPtr block, global::CoreLocation.CLLocationCoordinate2D coordinate, double altitude, NativeHandle error) {
var del = BlockLiteral.GetTarget<global::ARKit.GetGeolocationCallback> (block);
if (del is not null) {
del (coordinate, altitude, Runtime.GetNSObject<NSError> (error)!);
}
}
internal static unsafe global::ObjCRuntime.BlockLiteral CreateBlock (global::ARKit.GetGeolocationCallback callback) | ||
{ | ||
delegate* unmanaged<global::System.IntPtr, global::CoreLocation.CLLocationCoordinate2D, double, global::ObjCRuntime.NativeHandle, void> trampoline = &Invoke; | ||
return new global::ObjCRuntime.BlockLiteral (trampoline, callback, typeof (SDGetGeolocationCallback), nameof (Invoke)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generates the following code:
internal static unsafe BlockLiteral CreateBlock (global::ARKit.GetGeolocationCallback callback)
{
delegate* unmanaged<IntPtr, global::CoreLocation.CLLocationCoordinate2D, double, NativeHandle, void> trampoline = &Invoke;
return new BlockLiteral (trampoline, callback, typeof (SDGetGeolocationCallback), nameof (Invoke));
}
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #4a5e4c8] Build passed (Build packages) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #4a5e4c8] Build passed (Build macOS tests) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
❌ [CI Build #4a5e4c8] Tests on macOS X64 - Mac Sonoma (14) failed ❌Failed tests are:
Pipeline on Agent |
💻 [CI Build #4a5e4c8] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #4a5e4c8] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #587a806] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commit.NET ( No breaking changes )✅ API diff vs stable.NET ( No breaking changes )ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💻 [CI Build #4a5e4c8] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #4a5e4c8] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 126 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Add the tests that show that the ARKit trampoline static class is correctly generated.