From 3e816ea654736766e4c27c80d0abdc077498ca4a Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 27 Aug 2024 11:22:49 +0200 Subject: [PATCH] [xcode16] Revert workarounds for breaking changes in earlier betas due to Apple removing watchOS APIs --- runtime/trampolines.m | 12 ++---------- runtime/xamarin/trampolines.h | 8 -------- tests/test-libraries/testgenerator.cs | 3 --- 3 files changed, 2 insertions(+), 21 deletions(-) diff --git a/runtime/trampolines.m b/runtime/trampolines.m index c7fbd4938f7a..9183d963ebd5 100644 --- a/runtime/trampolines.m +++ b/runtime/trampolines.m @@ -1153,13 +1153,11 @@ // If called multiple times in succession, the returned pointer can be passed as the second ptr argument, and it need only be freed once done iterating. void *xamarin_nsvalue_to_nsrange (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle) { NSRange *valueptr = (NSRange *) (ptr ? ptr : xamarin_calloc (sizeof (NSRange))); *valueptr = [value rangeValue]; return valueptr; } #if HAVE_UIKIT // Yep, these CoreGraphics-looking category method is defined in UIKit. -#if !TARGET_OS_WATCH void *xamarin_nsvalue_to_cgaffinetransform (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle) { CGAffineTransform *valueptr = (CGAffineTransform *) (ptr ? ptr : xamarin_calloc (sizeof (CGAffineTransform))); *valueptr = [value CGAffineTransformValue]; return valueptr; } void *xamarin_nsvalue_to_cgpoint (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle) { CGPoint *valueptr = (CGPoint *) (ptr ? ptr : xamarin_calloc (sizeof (CGPoint))); *valueptr = [value CGPointValue]; return valueptr; } void *xamarin_nsvalue_to_cgrect (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle) { CGRect *valueptr = (CGRect *) (ptr ? ptr : xamarin_calloc (sizeof (CGRect))); *valueptr = [value CGRectValue]; return valueptr; } void *xamarin_nsvalue_to_cgsize (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle) { CGSize *valueptr = (CGSize *) (ptr ? ptr : xamarin_calloc (sizeof (CGSize))); *valueptr = [value CGSizeValue]; return valueptr; } void *xamarin_nsvalue_to_cgvector (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle) { CGVector *valueptr = (CGVector *) (ptr ? ptr : xamarin_calloc (sizeof (CGVector))); *valueptr = [value CGVectorValue]; return valueptr; } -#endif void *xamarin_nsvalue_to_nsdirectionaledgeinsets(NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle) {NSDirectionalEdgeInsets *valueptr =(NSDirectionalEdgeInsets *) (ptr ? ptr : xamarin_calloc (sizeof (NSDirectionalEdgeInsets)));*valueptr = [value directionalEdgeInsetsValue];return valueptr; } #endif #if HAVE_COREANIMATION @@ -1219,9 +1217,7 @@ } void *xamarin_nsvalue_to_scnvector4 (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle) { SCNVector4 *valueptr = (SCNVector4 *) (ptr ? ptr : xamarin_calloc (sizeof (SCNVector4))); *valueptr = [value SCNVector4Value]; return valueptr; } #if HAVE_UIKIT -#if !TARGET_OS_WATCH void *xamarin_nsvalue_to_uiedgeinsets (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle) { UIEdgeInsets *valueptr = (UIEdgeInsets *) (ptr ? ptr : xamarin_calloc (sizeof (UIEdgeInsets))); *valueptr = [value UIEdgeInsetsValue]; return valueptr; } -#endif void *xamarin_nsvalue_to_uioffset (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle) { UIOffset *valueptr = (UIOffset *) (ptr ? ptr : xamarin_calloc (sizeof (UIOffset))); *valueptr = [value UIOffsetValue]; return valueptr; } #endif @@ -1248,13 +1244,11 @@ id xamarin_nsrange_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle) { return [NSValue valueWithRange: *(NSRange *) mono_object_unbox (value)]; } #if HAVE_UIKIT // yep, these CoreGraphics-looking category methods are defined in UIKit -#if !TARGET_OS_WATCH id xamarin_cgaffinetransform_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle) { return [NSValue valueWithCGAffineTransform: *(CGAffineTransform *) mono_object_unbox (value)]; } id xamarin_cgpoint_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle) { return [NSValue valueWithCGPoint: *(CGPoint *) mono_object_unbox (value)]; } id xamarin_cgrect_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle) { return [NSValue valueWithCGRect: *(CGRect *) mono_object_unbox (value)]; } id xamarin_cgsize_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle) { return [NSValue valueWithCGSize: *(CGSize *) mono_object_unbox (value)]; } id xamarin_cgvector_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle) { return [NSValue valueWithCGVector: *(CGVector *) mono_object_unbox (value)]; } -#endif id xamarin_nsdirectionaledgeinsets_to_nsvalue(MonoObject *value, void *context, GCHandle *exception_gchandle) { return [NSValue valueWithDirectionalEdgeInsets:*(NSDirectionalEdgeInsets *)mono_object_unbox (value)]; } #endif #if HAVE_COREANIMATION @@ -1275,7 +1269,7 @@ id xamarin_scnmatrix4_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle) { return [NSValue valueWithSCNMatrix4: *(SCNMatrix4 *) mono_object_unbox (value)]; } id xamarin_scnvector3_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle) { return [NSValue valueWithSCNVector3: *(SCNVector3 *) mono_object_unbox (value)]; } id xamarin_scnvector4_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle) { return [NSValue valueWithSCNVector4: *(SCNVector4 *) mono_object_unbox (value)]; } -#if HAVE_UIKIT && !TARGET_OS_WATCH +#if HAVE_UIKIT id xamarin_uiedgeinsets_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle) { return [NSValue valueWithUIEdgeInsets: *(UIEdgeInsets *) mono_object_unbox (value)]; } id xamarin_uioffset_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle) { return [NSValue valueWithUIOffset: *(UIOffset *) mono_object_unbox (value)]; } #endif @@ -1606,7 +1600,6 @@ if (!strcmp (fullname, "Foundation.NSRange")) { func = to_managed ? (void *) xamarin_nsvalue_to_nsrange : (void *) xamarin_nsrange_to_nsvalue; #if HAVE_UIKIT // yep, these CoreGraphics-looking category methods are defined in UIKit -#if !TARGET_OS_WATCH } else if (!strcmp (fullname, "CoreGraphics.CGAffineTransform")) { func = to_managed ? (void *) xamarin_nsvalue_to_cgaffinetransform : (void *) xamarin_cgaffinetransform_to_nsvalue; } else if (!strcmp (fullname, "CoreGraphics.CGPoint")) { @@ -1617,7 +1610,6 @@ func = to_managed ? (void *) xamarin_nsvalue_to_cgsize : (void *) xamarin_cgsize_to_nsvalue; } else if (!strcmp (fullname, "CoreGraphics.CGVector")) { func = to_managed ? (void *) xamarin_nsvalue_to_cgvector : (void *) xamarin_cgvector_to_nsvalue; -#endif } else if (!strcmp (fullname, "UIKit.NSDirectionalEdgeInsets")) { func = to_managed ? (void *) xamarin_nsvalue_to_nsdirectionaledgeinsets : (void *) xamarin_nsdirectionaledgeinsets_to_nsvalue; #endif @@ -1649,7 +1641,7 @@ func = to_managed ? (void *) xamarin_nsvalue_to_scnvector3 : (void *) xamarin_scnvector3_to_nsvalue; } else if (!strcmp (fullname, "SceneKit.SCNVector4")) { func = to_managed ? (void *) xamarin_nsvalue_to_scnvector4 : (void *) xamarin_scnvector4_to_nsvalue; -#if HAVE_UIKIT && !TARGET_OS_WATCH +#if HAVE_UIKIT } else if (!strcmp (fullname, "UIKit.UIEdgeInsets")) { func = to_managed ? (void *) xamarin_nsvalue_to_uiedgeinsets : (void *) xamarin_uiedgeinsets_to_nsvalue; } else if (!strcmp (fullname, "UIKit.UIOffset")) { diff --git a/runtime/xamarin/trampolines.h b/runtime/xamarin/trampolines.h index 774555521152..ebf368948310 100644 --- a/runtime/xamarin/trampolines.h +++ b/runtime/xamarin/trampolines.h @@ -141,13 +141,11 @@ void *xamarin_nsnumber_to_nfloat (NSNumber *number, void *ptr, MonoClass *manage // Returns a pointer to the value type, which must be freed using xamarin_free void *xamarin_nsvalue_to_nsrange (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); -#if !TARGET_OS_WATCH void *xamarin_nsvalue_to_cgaffinetransform (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); void *xamarin_nsvalue_to_cgpoint (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); void *xamarin_nsvalue_to_cgrect (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); void *xamarin_nsvalue_to_cgsize (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); void *xamarin_nsvalue_to_cgvector (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); -#endif void *xamarin_nsvalue_to_catransform3d (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); void *xamarin_nsvalue_to_cllocationcoordinate2d (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); void *xamarin_nsvalue_to_cmtime (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); @@ -158,9 +156,7 @@ void *xamarin_nsvalue_to_mkcoordinatespan (NSValue *value, void *ptr, Mono void *xamarin_nsvalue_to_scnmatrix4 (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); void *xamarin_nsvalue_to_scnvector3 (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); void *xamarin_nsvalue_to_scnvector4 (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); -#if !TARGET_OS_WATCH void *xamarin_nsvalue_to_uiedgeinsets (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); -#endif void *xamarin_nsvalue_to_uioffset (NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); void *xamarin_nsvalue_to_nsdirectionaledgeinsets(NSValue *value, void *ptr, MonoClass *managedType, void *context, GCHandle *exception_gchandle); @@ -181,13 +177,11 @@ id xamarin_nfloat_to_nsnumber (MonoObject *value, void *context, GCHandle *excep id xamarin_nfloat_to_nsnumber (MonoObject *value, void *context, GCHandle *exception_gchandle); id xamarin_nsrange_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); -#if !TARGET_OS_WATCH id xamarin_cgaffinetransform_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); id xamarin_cgpoint_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); id xamarin_cgrect_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); id xamarin_cgsize_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); id xamarin_cgvector_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); -#endif id xamarin_catransform3d_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); id xamarin_cllocationcoordinate2d_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); id xamarin_cmtime_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); @@ -198,10 +192,8 @@ id xamarin_mkcoordinatespan_to_nsvalue (MonoObject *value, void *context, id xamarin_scnmatrix4_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); id xamarin_scnvector3_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); id xamarin_scnvector4_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); -#if !TARGET_OS_WATCH id xamarin_uiedgeinsets_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); id xamarin_uioffset_to_nsvalue (MonoObject *value, void *context, GCHandle *exception_gchandle); -#endif id xamarin_nsdirectionaledgeinsets_to_nsvalue(MonoObject *value, void *context, GCHandle *exception_gchandle); // These functions can be passed as xamarin_id_to_managed_func/xamarin_managed_to_id_func parameters diff --git a/tests/test-libraries/testgenerator.cs b/tests/test-libraries/testgenerator.cs index fb35dc4a72de..6aa578232032 100644 --- a/tests/test-libraries/testgenerator.cs +++ b/tests/test-libraries/testgenerator.cs @@ -803,8 +803,6 @@ static void WriteRegistrarTests () using XamarinTests.ObjCRuntime; using Xamarin.Utils; -#if !__WATCHOS__ - namespace MonoTouchFixtures.ObjCRuntime { [TestFixture] @@ -1414,7 +1412,6 @@ public partial class RegistrarTestGenerated {"); w.AppendLine (@" } }"); - w.AppendLine ("#endif // __WATCHOS__"); File.WriteAllText ("RegistrarTest.generated.cs", w.ToString ()); }