Fix a number of introspection test failures on 10.13 (#2815) (#2833)

This commit is contained in:
Chris Hamons 2017-10-03 12:59:13 -05:00 коммит произвёл GitHub
Родитель 0f4a8b77ef
Коммит 75235cdf17
18 изменённых файлов: 70 добавлений и 27 удалений

Просмотреть файл

@ -397,11 +397,11 @@ namespace XamCore.AudioUnit
#endif
#if IOS || MONOMAC
[NoWatch, NoTV, Mac (10,13), iOS (11,0)]
[NoWatch, NoTV, Mac (10,13, onlyOn64: true), iOS (11,0)]
[DllImport (Constants.AudioUnitLibrary)]
static extern int /* OSStatus */ AudioUnitExtensionSetComponentList (IntPtr /* CFString */ extensionIdentifier, /* CFArrayRef */ IntPtr audioComponentInfo);
[NoWatch, NoTV, Mac (10,13), iOS (11,0)]
[NoWatch, NoTV, Mac (10,13, onlyOn64: true), iOS (11,0)]
[DllImport (Constants.AudioUnitLibrary)]
static extern /* CFArrayRef */ IntPtr AudioUnitExtensionCopyComponentList (IntPtr /* CFString */ extensionIdentifier);

Просмотреть файл

@ -130,7 +130,7 @@ namespace MonoMac {
public const string CoreMLLibrary = "/System/Library/Frameworks/CoreML.framework/CoreML";
public const string VisionLibrary = "/System/Library/Frameworks/Vision.framework/Vision";
public const string IOSurfaceLibrary = "/System/Library/Frameworks/IOSurface.framework/IOSurface";
public const string PhotosUILibrary = "/System/Library/Frameworks/Photos.framework/PhotosUI";
public const string PhotosUILibrary = "/System/Library/Frameworks/PhotosUI.framework/PhotosUI";
public const string ExternalAccessoryLibrary = "/System/Library/Frameworks/ExternalAccessory.framework/ExternalAccessory";
}
}

Просмотреть файл

@ -95,6 +95,7 @@ namespace XamCore.Foundation {
static IntPtr io = Dlfcn.dlopen (Constants.ModelIOLibrary, 1);
static IntPtr nc = Dlfcn.dlopen (Constants.NotificationCenterLibrary, 1);
static IntPtr pl = Dlfcn.dlopen (Constants.PhotosLibrary, 1);
static IntPtr pu = Dlfcn.dlopen (Constants.PhotosUILibrary, 1);
static IntPtr mp = Dlfcn.dlopen (Constants.MediaPlayerLibrary, 1);
static IntPtr pc = Dlfcn.dlopen (Constants.PrintCoreLibrary, 1);
static IntPtr cml = Dlfcn.dlopen (Constants.CoreMLLibrary, 1);

Просмотреть файл

@ -59,6 +59,7 @@ namespace XamCore.CoreBluetooth {
[Protocolize]
CBCentralManagerDelegate Delegate { get; set; }
[Mac (10, 7, onlyOn64: true)] // Was removed from 32-bit in 10.13 unannounced
[Export ("initWithDelegate:queue:")]
[PostGet ("WeakDelegate")]
IntPtr Constructor ([NullAllowed, Protocolize] CBCentralManagerDelegate centralDelegate, [NullAllowed] DispatchQueue queue);
@ -482,11 +483,11 @@ namespace XamCore.CoreBluetooth {
[Export ("state")]
CBPeripheralState State { get; }
[iOS (11,0)][TV (11,0)][Mac (10,13)]
[iOS (11,0)][TV (11,0)][Mac (10,13, onlyOn64: true)]
[Export ("canSendWriteWithoutResponse")]
bool CanSendWriteWithoutResponse { get; }
[iOS (11,0)][TV (11,0)][Mac (10,13)]
[iOS (11,0)][TV (11,0)][Mac (10,13, onlyOn64: true)]
[Export ("openL2CAPChannel:")]
void OpenL2CapChannel (ushort psm);
}
@ -779,8 +780,14 @@ namespace XamCore.CoreBluetooth {
[Watch (4,0)]
[Since (6, 0), Mac(10,9)]
[DisableDefaultCtor]
[BaseType (typeof (CBManager), Delegates=new[] { "WeakDelegate" }, Events=new[] { typeof (CBPeripheralManagerDelegate) })]
interface CBPeripheralManager {
[Mac (10,9, onlyOn64: true)] // Was removed from 32-bit in 10.13 unannounced
[Export ("init")]
IntPtr Constructor ();
[NoTV]
[NoWatch]
[Export ("initWithDelegate:queue:")]
@ -834,11 +841,11 @@ namespace XamCore.CoreBluetooth {
[Export ("updateValue:forCharacteristic:onSubscribedCentrals:")]
bool UpdateValue (NSData value, CBMutableCharacteristic characteristic, [NullAllowed] CBCentral[] subscribedCentrals);
[iOS (11,0)][TV (11,0)][Mac (10,13)]
[iOS (11,0)][TV (11,0)][Mac (10,13, onlyOn64: true)]
[Export ("publishL2CAPChannelWithEncryption:")]
void PublishL2CapChannel (bool encryptionRequired);
[iOS (11,0)][TV (11,0)][Mac (10,13)]
[iOS (11,0)][TV (11,0)][Mac (10,13, onlyOn64: true)]
[Export ("unpublishL2CAPChannel:")]
void UnpublishL2CapChannel (ushort psm);
@ -935,19 +942,23 @@ namespace XamCore.CoreBluetooth {
NSUuid Identifier { get; }
}
// The type is available in 32bits macOS 10.13 even if most properties are 64 bits only
[Watch (4,0)][iOS (11,0)][TV (11,0)][Mac (10,13)]
[BaseType (typeof (NSObject), Name = "CBL2CAPChannel")]
interface CBL2CapChannel {
[Mac (10,13, onlyOn64: true)]
[Export ("peer")]
CBPeer Peer { get; }
[Mac (10,13, onlyOn64: true)]
[Export ("inputStream")]
NSInputStream InputStream { get; }
[Mac (10,13, onlyOn64: true)]
[Export ("outputStream")]
NSOutputStream OutputStream { get; }
[Mac (10,13, onlyOn64: true)]
[Export ("PSM")]
/* uint16_t */ ushort Psm { get; }
}

Просмотреть файл

@ -14,7 +14,7 @@ using XamCore.UIKit;
namespace XamCore.ExternalAccessory {
[Mac (10, 13)][TV (10,0)]
[Mac (10, 13, onlyOn64: true)][TV (10,0)]
[BaseType (typeof (NSObject), Delegates=new string [] { "WeakDelegate" }, Events=new Type [] {typeof(EAAccessoryDelegate)})]
// Objective-C exception thrown. Name: EAAccessoryInitException Reason: -init not supported. EAAccessoryManager is responsible for creating all objects.
[DisableDefaultCtor]
@ -58,7 +58,7 @@ namespace XamCore.ExternalAccessory {
string DockType { get; }
}
[Mac (10, 13)][TV (10,0)]
[Mac (10, 13, onlyOn64: true)][TV (10,0)]
[BaseType (typeof (NSObject))]
[Model]
[Protocol]
@ -67,7 +67,7 @@ namespace XamCore.ExternalAccessory {
void Disconnected (EAAccessory accessory);
}
[Mac (10, 13)][TV (10,0)]
[Mac (10, 13, onlyOn64: true)][TV (10,0)]
interface EAAccessoryEventArgs {
[Export ("EAAccessoryKey")]
EAAccessory Accessory { get; }
@ -77,7 +77,7 @@ namespace XamCore.ExternalAccessory {
EAAccessory Selected { get; }
}
[Mac (10, 13)][TV (10,0)]
[Mac (10, 13, onlyOn64: true)][TV (10,0)]
[BaseType (typeof (NSObject))]
// Objective-C exception thrown. Name: EAAccessoryManagerInitException Reason: -init is not supported. Use +sharedAccessoryManager.
[DisableDefaultCtor]
@ -116,7 +116,7 @@ namespace XamCore.ExternalAccessory {
void ShowBluetoothAccessoryPicker ([NullAllowed] NSPredicate predicate, [NullAllowed] Action<NSError> completion);
}
[Mac (10, 13)][TV (10,0)]
[Mac (10, 13, onlyOn64: true)][TV (10,0)]
[BaseType (typeof (NSObject))]
// Objective-C exception thrown. Name: EASessionInitException Reason: -init not supported. use -initWithAccessory:forProtocol.
[DisableDefaultCtor]

Просмотреть файл

@ -5280,7 +5280,9 @@ namespace XamCore.Foundation
#if MONOMAC
, NSPasteboardReading, NSPasteboardWriting
#endif
#if !(MONOMAC && !XAMCORE_2_0) // exclude Classic/XM
, NSItemProviderWriting, NSItemProviderReading
#endif
{
[Export ("initWithScheme:host:path:")]
IntPtr Constructor (string scheme, string host, string path);
@ -5972,20 +5974,20 @@ namespace XamCore.Foundation
#endif
// From the NSItemProviderReading protocol
[Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)]
[Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
[Static]
[Export ("readableTypeIdentifiersForItemProvider", ArgumentSemantic.Copy)]
new string[] ReadableTypeIdentifiers { get; }
// From the NSItemProviderReading protocol
[Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)]
[Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
[Static]
[Export ("objectWithItemProviderData:typeIdentifier:error:")]
[return: NullAllowed]
new NSUrl GetObject (NSData data, string typeIdentifier, [NullAllowed] out NSError outError);
// From the NSItemProviderWriting protocol
[Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)]
[Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
[Static]
[Export ("writableTypeIdentifiersForItemProvider", ArgumentSemantic.Copy)]
new string[] WritableTypeIdentifiers { get; }
@ -7788,7 +7790,9 @@ namespace XamCore.Foundation
#if MONOMAC
, NSPasteboardReading, NSPasteboardWriting // Documented that it implements NSPasteboard protocols even if header doesn't show it
#endif
#if !(MONOMAC && !XAMCORE_2_0) // exclude Classic/XM
, NSItemProviderReading, NSItemProviderWriting
#endif
{
[Export ("initWithData:encoding:")]
IntPtr Constructor (NSData data, NSStringEncoding encoding);
@ -8050,19 +8054,19 @@ namespace XamCore.Foundation
// From the NSItemProviderReading protocol
[Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)]
[Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
[Static]
[Export ("readableTypeIdentifiersForItemProvider", ArgumentSemantic.Copy)]
new string[] ReadableTypeIdentifiers { get; }
[Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)]
[Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
[Static]
[Export ("objectWithItemProviderData:typeIdentifier:error:")]
[return: NullAllowed]
new NSString GetObject (NSData data, string typeIdentifier, [NullAllowed] out NSError outError);
// From the NSItemProviderWriting protocol
[Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)]
[Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
[Static]
[Export ("writableTypeIdentifiersForItemProvider", ArgumentSemantic.Copy)]
new string[] WritableTypeIdentifiers { get; }
@ -9742,7 +9746,7 @@ namespace XamCore.Foundation
interface INSItemProviderReading {}
[Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)]
[Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
[Protocol]
interface NSItemProviderReading
{
@ -9765,7 +9769,7 @@ namespace XamCore.Foundation
interface INSItemProviderWriting {}
[Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)]
[Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
[Protocol]
interface NSItemProviderWriting
{

Просмотреть файл

@ -185,7 +185,7 @@ namespace XamCore.SafariServices {
void ShowPreferencesForExtension (string identifier, [NullAllowed] Action<NSError> completionHandler);
[Mac (10,12,4, onlyOn64 : true)]
[Advice ("Unavailable to extensions")]
[Advice ("Unavailable to extensions.")]
[Static][Async]
[Export ("dispatchMessageWithName:toExtensionWithIdentifier:userInfo:completionHandler:")]
void DispatchMessage (string messageName, string identifier, [NullAllowed] NSDictionary<NSString, NSObject> userInfo, [NullAllowed] Action<NSError> completionHandler);

Просмотреть файл

@ -3398,7 +3398,7 @@ namespace XamCore.SpriteKit {
// SKRenderer is not available for WatchKit apps and the iOS simulator
[NoWatch]
[TV (11,0), Mac (10,13), iOS (11,0)]
[TV (11,0), Mac (10,13, onlyOn64 : true), iOS (11,0)]
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface SKRenderer {

Просмотреть файл

@ -61,7 +61,7 @@ namespace XamCore.WebKit
WKBackForwardListItem ItemAtIndex (nint index);
}
[Mac (10,13), iOS (11,0)]
[Mac (10,13, onlyOn64: true), iOS (11,0)]
[BaseType (typeof(NSObject))]
interface WKContentRuleList
{
@ -69,7 +69,7 @@ namespace XamCore.WebKit
string Identifier { get; }
}
[Mac (10,13), iOS (11,0)]
[Mac (10,13, onlyOn64: true), iOS (11,0)]
[BaseType (typeof(NSObject))]
interface WKContentRuleListStore
{
@ -303,7 +303,7 @@ namespace XamCore.WebKit
}
[Mac (10,13), iOS (11,0)]
[Mac (10,13, onlyOn64: true), iOS (11,0)]
[BaseType (typeof(NSObject))]
interface WKSnapshotConfiguration : NSCopying {
[Export ("rect")]

Просмотреть файл

@ -67,6 +67,7 @@ namespace Xamarin.Mac.Tests
case "SocialLibrary":
case "SpriteKitLibrary":
case "PhotosLibrary":
case "PhotosUILibrary":
case "IntentsLibrary":
case "MediaPlayerLibrary":
return LoadStatus.Acceptable;

Просмотреть файл

@ -75,6 +75,7 @@ namespace Introspection
"Accurracy",
"Achivements",
"Acos",
"Acn",
"Actionname",
"Activitiy",
"Addin",

Просмотреть файл

@ -155,6 +155,10 @@ namespace Introspection {
case "MonoMac.AppKit.NSMutableFontCollection":
case "AppKit.NSMutableFontCollection":
return true; // Crashes in 10.12
case "CoreBluetooth.CBCentralManager":
if (IntPtr.Size == 4 && Mac.CheckSystemVersion (10, 13)) // 32-bit removed unannounced in 10.13
return true;
break;
}
switch (type.Namespace) {

Просмотреть файл

@ -155,6 +155,10 @@ namespace Introspection {
// MonoMac.CoreServices.CFHTTPMessage - document in 10.9 but returns null
case "_AuthenticationSchemeOAuth1":
return true;
case "CBUUIDValidRangeString":
if (Mac.CheckSystemVersion (10, 13)); // radar 32858911
return true;
break;
default:
return base.Skip (p);
}

Просмотреть файл

@ -217,6 +217,16 @@ namespace Introspection {
break;
}
break;
case "NSItemProviderWriting":
switch (type.Name) {
case "NSMutableString":
case "NSString":
case "NSUrl":
if (IntPtr.Size == 4) // Only on 64-bit version of these types
return true;
break;
}
break;
}
switch (type.Name) {

Просмотреть файл

@ -20,6 +20,9 @@ namespace Introspection {
return true;
case "NSAttributedStringDocumentAttributes": // NSAttributedStringDocumentAttributes.WeakDocumentType is done by hand, not a binding
return true;
// VNImageOptions is a DictionaryContainer that exposes a Weak* NSDictionary
case "VNImageOptions":
return true;
}
return base.Skip (type);
}

Просмотреть файл

@ -2376,6 +2376,7 @@ namespace XamCore.Registrar {
static bool IsQTKitType (ObjCType type) => IsTypeCore (type, "QTKit");
static bool IsMapKitType (ObjCType type) => IsTypeCore (type, "MapKit");
static bool IsIntentsType (ObjCType type) => IsTypeCore (type, "Intents");
static bool IsExternalAccessoryType (ObjCType type) => IsTypeCore (type, "ExternalAccessory");
static bool IsMetalType (ObjCType type)
{
@ -2434,7 +2435,7 @@ namespace XamCore.Registrar {
// These are 64-bit frameworks that extend NSExtensionContext / NSUserActivity, which you can't do
// if the header doesn't declare them. So hack it away, since they are useless in 64-bit anyway
if (!Is64Bits && (IsMapKitType (@class) || IsIntentsType (@class)))
if (!Is64Bits && (IsMapKitType (@class) || IsIntentsType (@class) || IsExternalAccessoryType (@class)))
continue;
#endif

Просмотреть файл

@ -62,6 +62,7 @@ namespace Xamarin.Linker {
IOSurface = profile.GetNamespace ("IOSurface");
PdfKit = profile.GetNamespace ("PdfKit");
#if MONOMAC
PhotosUI = profile.GetNamespace ("PhotosUI");
IOBluetooth = profile.GetNamespace ("IOBluetooth");
IOBluetoothUI = profile.GetNamespace ("IOBluetoothUI");
FinderSync = profile.GetNamespace ("FinderSync");
@ -147,6 +148,7 @@ namespace Xamarin.Linker {
public static string PdfKit { get; private set; }
#if MONOMAC
public static string PhotosUI { get; private set; }
public static string IOBluetooth { get; private set; }
public static string IOBluetoothUI { get; private set; }
public static string FinderSync { get; private set; }

Просмотреть файл

@ -68,6 +68,7 @@ namespace MonoMac.Tuner {
{ Constants.MediaPlayerLibrary, Namespaces.MediaPlayer },
{ Constants.IntentsLibrary, Namespaces.Intents },
{ Constants.PhotosLibrary, Namespaces.Photos },
{ Constants.PhotosUILibrary, Namespaces.PhotosUI },
{ Constants.PrintCoreLibrary, Namespaces.PrintCore },
{ Constants.CoreMLLibrary, Namespaces.CoreML },
{ Constants.VisionLibrary, Namespaces.Vision },