From 40036f0ef89229cc35ae0aff5d6d88bb876926fc Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Saenz Date: Thu, 27 Jun 2024 17:12:12 -0400 Subject: [PATCH] [Xcode16] Allow the runtime to compile with Xcode 16 beta 2. --- Make.config | 4 ++-- runtime/trampolines.m | 12 ++++++++++-- runtime/xamarin/trampolines.h | 8 ++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Make.config b/Make.config index 35d0e21ad876..adb4d5842e47 100644 --- a/Make.config +++ b/Make.config @@ -213,8 +213,8 @@ MACCATALYST_NUGET_VERSION_FULL=$(MACCATALYST_NUGET_VERSION_NO_METADATA)+$(NUGET_ # Xcode version should have both a major and a minor version (even if the minor version is 0) XCODE_VERSION=16.0 -XCODE_URL=https://dl.internalx.com/internal-files/xcodes/Xcode_16-beta.xip -XCODE_DEVELOPER_ROOT=/Applications/Xcode_16.0.0-beta.app/Contents/Developer +XCODE_URL=https://dl.internalx.com/internal-files/xcodes/Xcode_16-beta_2.xip +XCODE_DEVELOPER_ROOT=/Applications/Xcode_16.0.0-beta2.app/Contents/Developer XCODE_PRODUCT_BUILD_VERSION:=$(shell /usr/libexec/PlistBuddy -c 'Print :ProductBuildVersion' $(XCODE_DEVELOPER_ROOT)/../version.plist 2>/dev/null || echo " $(shell tput setaf 1 2>/dev/null)The required Xcode ($(XCODE_VERSION)) is not installed in $(basename $(basename $(XCODE_DEVELOPER_ROOT)))$(shell tput sgr0 2>/dev/null)" >&2) # We define stable Xcode as the Xcode app being named like "Xcode_#.#[.#].app" diff --git a/runtime/trampolines.m b/runtime/trampolines.m index 9183d963ebd5..c7fbd4938f7a 100644 --- a/runtime/trampolines.m +++ b/runtime/trampolines.m @@ -1153,11 +1153,13 @@ // 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 @@ -1217,7 +1219,9 @@ } 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 @@ -1244,11 +1248,13 @@ 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 @@ -1269,7 +1275,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 +#if HAVE_UIKIT && !TARGET_OS_WATCH 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 @@ -1600,6 +1606,7 @@ 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")) { @@ -1610,6 +1617,7 @@ 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 @@ -1641,7 +1649,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 +#if HAVE_UIKIT && !TARGET_OS_WATCH } 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 ebf368948310..774555521152 100644 --- a/runtime/xamarin/trampolines.h +++ b/runtime/xamarin/trampolines.h @@ -141,11 +141,13 @@ 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); @@ -156,7 +158,9 @@ 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); @@ -177,11 +181,13 @@ 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); @@ -192,8 +198,10 @@ 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