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

[CoreFoundation] Add support for xcode 13 beta 5. #12552

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion src/CoreFoundation/CFBundle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;

using ObjCRuntime;
using CoreFoundation;
Expand Down Expand Up @@ -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")]
Copy link
Contributor

Choose a reason for hiding this comment

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

That code is not complied for iOS or tvOS so UnsupportedOSPlatform is not helpful on a private member.

On a public member is has some value (documentation), e.g. you doing Mac work but you'll notice your API won't be available if the code eventually needs to be used on iOS.

However on a private member it's only useful to have availability because it helps introspection to detect mistakes. That code won't be present for (example) iOS so introspection won't be using it. So this is only extraneous metadata.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should I be doing something similar for the ones that I am doing?

#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")]
Copy link
Contributor

Choose a reason for hiding this comment

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

fine here (public)

#endif
public static bool IsExecutableLoadable (CFBundle bundle)
{
if (bundle == null)
Expand All @@ -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")]
Copy link
Contributor

Choose a reason for hiding this comment

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

not here (private)

#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)
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions tests/xtro-sharpie/common-CoreFoundation.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions tests/xtro-sharpie/iOS-CoreFoundation.ignore

This file was deleted.

2 changes: 0 additions & 2 deletions tests/xtro-sharpie/macOS-CoreFoundation.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/xtro-sharpie/tvOS-CoreFoundation.ignore

This file was deleted.