From d3cc984004393c4524fef85412fd2da16fcc2187 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 25 Aug 2021 17:35:07 -0400 Subject: [PATCH 1/2] [CoreFoundation] Add support for xcode 13 beta 5. --- src/CoreFoundation/CFBundle.cs | 33 ++++++++++++++++++- ...todo => MacCatalyst-CoreFoundation.ignore} | 6 +--- .../xtro-sharpie/common-CoreFoundation.ignore | 3 ++ tests/xtro-sharpie/iOS-CoreFoundation.ignore | 3 -- .../xtro-sharpie/macOS-CoreFoundation.ignore | 2 -- tests/xtro-sharpie/tvOS-CoreFoundation.ignore | 1 - 6 files changed, 36 insertions(+), 12 deletions(-) rename tests/xtro-sharpie/{MacCatalyst-CoreFoundation.todo => MacCatalyst-CoreFoundation.ignore} (85%) delete mode 100644 tests/xtro-sharpie/iOS-CoreFoundation.ignore delete mode 100644 tests/xtro-sharpie/tvOS-CoreFoundation.ignore diff --git a/src/CoreFoundation/CFBundle.cs b/src/CoreFoundation/CFBundle.cs index ebb38da48ac..d4dae1b5150 100644 --- a/src/CoreFoundation/CFBundle.cs +++ b/src/CoreFoundation/CFBundle.cs @@ -3,6 +3,7 @@ // using System; using System.Runtime.InteropServices; +using System.Runtime.Versioning; using ObjCRuntime; using CoreFoundation; @@ -603,13 +604,23 @@ public CFBundle.Architecture[] Architectures { } } -#if MONOMAC +#if MONOMAC || __MACCATALYST__ +#if !NET [Introduced (PlatformName.MacOSX, 11, 0)] + [MacCatalyst (15,0)] +#else + [UnsupportedOSPlatform ("ios"), UnsupportedOSPlatform ("tvos"), SupportedOSPlatform ("macos11.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif [DllImport (Constants.CoreFoundationLibrary)] [return: MarshalAs (UnmanagedType.I1)] extern static bool CFBundleIsExecutableLoadable (IntPtr bundle); +#if !NET [Introduced (PlatformName.MacOSX, 11, 0)] + [MacCatalyst (15,0)] +#else + [UnsupportedOSPlatform ("ios"), UnsupportedOSPlatform ("tvos"), SupportedOSPlatform ("macos11.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif public static bool IsExecutableLoadable (CFBundle bundle) { if (bundle == null) @@ -620,12 +631,22 @@ public static bool IsExecutableLoadable (CFBundle bundle) return CFBundleIsExecutableLoadable (bundle.Handle); } +#if !NET [Introduced (PlatformName.MacOSX, 11, 0)] + [MacCatalyst (15,0)] +#else + [UnsupportedOSPlatform ("ios"), UnsupportedOSPlatform ("tvos"), SupportedOSPlatform ("macos11.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif [DllImport (Constants.CoreFoundationLibrary)] [return: MarshalAs (UnmanagedType.I1)] extern static bool CFBundleIsExecutableLoadableForURL (IntPtr bundle); +#if !NET [Introduced (PlatformName.MacOSX, 11, 0)] + [MacCatalyst (15,0)] +#else + [UnsupportedOSPlatform ("ios"), UnsupportedOSPlatform ("tvos"), SupportedOSPlatform ("macos11.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif public static bool IsExecutableLoadable (NSUrl url) { if (url == null) @@ -634,12 +655,22 @@ public static bool IsExecutableLoadable (NSUrl url) return CFBundleIsExecutableLoadableForURL (url.Handle); } +#if !NET [Introduced (PlatformName.MacOSX, 11, 0)] + [MacCatalyst (15,0)] +#else + [UnsupportedOSPlatform ("ios"), UnsupportedOSPlatform ("tvos"), SupportedOSPlatform ("macos11.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif [DllImport (Constants.CoreFoundationLibrary)] [return: MarshalAs (UnmanagedType.I1)] extern static bool CFBundleIsArchitectureLoadable (/*cpu_type_t => integer_t => int*/ Architecture architecture); +#if !NET [Introduced (PlatformName.MacOSX, 11, 0)] + [MacCatalyst (15,0)] +#else + [UnsupportedOSPlatform ("ios"), UnsupportedOSPlatform ("tvos"), SupportedOSPlatform ("macos11.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif public static bool IsArchitectureLoadable (Architecture architecture) => CFBundleIsArchitectureLoadable (architecture); #endif diff --git a/tests/xtro-sharpie/MacCatalyst-CoreFoundation.todo b/tests/xtro-sharpie/MacCatalyst-CoreFoundation.ignore similarity index 85% rename from tests/xtro-sharpie/MacCatalyst-CoreFoundation.todo rename to tests/xtro-sharpie/MacCatalyst-CoreFoundation.ignore index f0debe3d7cc..0ec5273567a 100644 --- a/tests/xtro-sharpie/MacCatalyst-CoreFoundation.todo +++ b/tests/xtro-sharpie/MacCatalyst-CoreFoundation.ignore @@ -1,8 +1,7 @@ +# all of the are ignored on mac os x. !missing-field! kCFURLApplicationIsScriptableKey not bound !missing-field! kCFURLQuarantinePropertiesKey not bound !missing-field! kCFURLTagNamesKey not bound -!missing-field! kCFURLVolumeAvailableCapacityForImportantUsageKey not bound -!missing-field! kCFURLVolumeAvailableCapacityForOpportunisticUsageKey not bound !missing-field! kCFUserNotificationAlertHeaderKey not bound !missing-field! kCFUserNotificationAlertMessageKey not bound !missing-field! kCFUserNotificationAlertTopMostKey not bound @@ -20,9 +19,6 @@ !missing-field! kCFUserNotificationTextFieldTitlesKey not bound !missing-field! kCFUserNotificationTextFieldValuesKey not bound !missing-pinvoke! CFBundleCloseBundleResourceMap is not bound -!missing-pinvoke! CFBundleIsArchitectureLoadable is not bound -!missing-pinvoke! CFBundleIsExecutableLoadable is not bound -!missing-pinvoke! CFBundleIsExecutableLoadableForURL is not bound !missing-pinvoke! CFBundleOpenBundleResourceFiles is not bound !missing-pinvoke! CFBundleOpenBundleResourceMap is not bound !missing-pinvoke! CFURLCreateBookmarkDataFromAliasRecord is not bound diff --git a/tests/xtro-sharpie/common-CoreFoundation.ignore b/tests/xtro-sharpie/common-CoreFoundation.ignore index b8b2ababbb4..0f7ce746980 100644 --- a/tests/xtro-sharpie/common-CoreFoundation.ignore +++ b/tests/xtro-sharpie/common-CoreFoundation.ignore @@ -5,6 +5,8 @@ !missing-field! kCFURLFileProtectionKey not bound !missing-field! kCFURLFileProtectionNone not bound !missing-field! kCFURLVolumeSupportsFileProtectionKey not bound +!missing-field! kCFURLVolumeAvailableCapacityForImportantUsageKey not bound +!missing-field! kCFURLVolumeAvailableCapacityForOpportunisticUsageKey not bound @@ -981,6 +983,7 @@ !unknown-pinvoke! dispatch_write bound !unknown-pinvoke! open bound !unknown-pinvoke! write bound +!unknown-pinvoke! uname bound !missing-field! kCFStreamErrorDomainSOCKS not bound !missing-field! kCFStreamErrorDomainSSL not bound !missing-field! kCFStreamPropertyShouldCloseNativeSocket not bound diff --git a/tests/xtro-sharpie/iOS-CoreFoundation.ignore b/tests/xtro-sharpie/iOS-CoreFoundation.ignore deleted file mode 100644 index e088b37c086..00000000000 --- a/tests/xtro-sharpie/iOS-CoreFoundation.ignore +++ /dev/null @@ -1,3 +0,0 @@ -!missing-field! kCFURLVolumeAvailableCapacityForImportantUsageKey not bound -!missing-field! kCFURLVolumeAvailableCapacityForOpportunisticUsageKey not bound -!unknown-pinvoke! uname bound diff --git a/tests/xtro-sharpie/macOS-CoreFoundation.ignore b/tests/xtro-sharpie/macOS-CoreFoundation.ignore index 732af966c99..145254fc2b5 100644 --- a/tests/xtro-sharpie/macOS-CoreFoundation.ignore +++ b/tests/xtro-sharpie/macOS-CoreFoundation.ignore @@ -18,8 +18,6 @@ !missing-field! kCFURLApplicationIsScriptableKey not bound !missing-field! kCFURLQuarantinePropertiesKey not bound !missing-field! kCFURLTagNamesKey not bound -!missing-field! kCFURLVolumeAvailableCapacityForImportantUsageKey not bound -!missing-field! kCFURLVolumeAvailableCapacityForOpportunisticUsageKey not bound !missing-field! kCFUserNotificationAlertHeaderKey not bound !missing-field! kCFUserNotificationAlertMessageKey not bound !missing-field! kCFUserNotificationAlternateButtonTitleKey not bound diff --git a/tests/xtro-sharpie/tvOS-CoreFoundation.ignore b/tests/xtro-sharpie/tvOS-CoreFoundation.ignore deleted file mode 100644 index 4aee78c11b4..00000000000 --- a/tests/xtro-sharpie/tvOS-CoreFoundation.ignore +++ /dev/null @@ -1 +0,0 @@ -!unknown-pinvoke! uname bound From dae1395327536f42cf5ca73b03013182e978d167 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Thu, 26 Aug 2021 11:12:55 -0400 Subject: [PATCH 2/2] Remove not needed metadata. --- src/CoreFoundation/CFBundle.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CoreFoundation/CFBundle.cs b/src/CoreFoundation/CFBundle.cs index d4dae1b5150..b1982c34ea4 100644 --- a/src/CoreFoundation/CFBundle.cs +++ b/src/CoreFoundation/CFBundle.cs @@ -609,7 +609,7 @@ public CFBundle.Architecture[] Architectures { [Introduced (PlatformName.MacOSX, 11, 0)] [MacCatalyst (15,0)] #else - [UnsupportedOSPlatform ("ios"), UnsupportedOSPlatform ("tvos"), SupportedOSPlatform ("macos11.0"), SupportedOSPlatform ("maccatalyst15.0")] + [SupportedOSPlatform ("macos11.0"), SupportedOSPlatform ("maccatalyst15.0")] #endif [DllImport (Constants.CoreFoundationLibrary)] [return: MarshalAs (UnmanagedType.I1)] @@ -635,7 +635,7 @@ public static bool IsExecutableLoadable (CFBundle bundle) [Introduced (PlatformName.MacOSX, 11, 0)] [MacCatalyst (15,0)] #else - [UnsupportedOSPlatform ("ios"), UnsupportedOSPlatform ("tvos"), SupportedOSPlatform ("macos11.0"), SupportedOSPlatform ("maccatalyst15.0")] + [SupportedOSPlatform ("macos11.0"), SupportedOSPlatform ("maccatalyst15.0")] #endif [DllImport (Constants.CoreFoundationLibrary)] [return: MarshalAs (UnmanagedType.I1)] @@ -659,7 +659,7 @@ public static bool IsExecutableLoadable (NSUrl url) [Introduced (PlatformName.MacOSX, 11, 0)] [MacCatalyst (15,0)] #else - [UnsupportedOSPlatform ("ios"), UnsupportedOSPlatform ("tvos"), SupportedOSPlatform ("macos11.0"), SupportedOSPlatform ("maccatalyst15.0")] + [SupportedOSPlatform ("macos11.0"), SupportedOSPlatform ("maccatalyst15.0")] #endif [DllImport (Constants.CoreFoundationLibrary)] [return: MarshalAs (UnmanagedType.I1)]