[registrar] Register models in the static registrar. (#3386)

* [registrar] Register models in the static registrar.

This also means we need to quiet a few types of warnings:.

* Models declares virtual methods of required protocol members. We don't
  export virtual methods (only when they're overridden are they exported),
  which results in numerous warnings about protocol members not being
  implemented:

        Xamarin.Mac.registrar.mobile.x86_64.m:37827:17: warning: method 'deviceBrowserView:selectionDidChange:' in protocol 'IKDeviceBrowserViewDelegate' not implemented [-Wprotocol]
        @implementation ImageKit_IKDeviceBrowserView__IKDeviceBrowserViewDelegate {
                        ^
        /Applications/Xcode92.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Quartz.framework/Frameworks/ImageKit.framework/Headers/IKDeviceBrowserView.h:29:1: note: method 'deviceBrowserView:selectionDidChange:' declared here
        - (void)deviceBrowserView: (IKDeviceBrowserView *)deviceBrowserView selectionDidChange: (ICDevice *)device;

* These two are the same as above, just for properties instead of methods.

        Xamarin.Mac.registrar.mobile.x86_64.m:31988:17: warning: auto property synthesis will not synthesize property 'boundingMapRect' declared in protocol 'MKOverlay' [-Wobjc-protocol-property-synthesis]
        @implementation MKOverlay {
                        ^
        /Applications/Xcode92.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/MapKit.framework/Headers/MKOverlay.h:24:43: note: property declared here
        @property (nonatomic, readonly) MKMapRect boundingMapRect;
                                                  ^
        Xamarin.Mac.registrar.mobile.x86_64.m:32002:1: note: add a '@synthesize' directive
        @end
        ^

        Xamarin.Mac.registrar.mobile.i386.m:28957:17: warning: property 'repeatCount' requires method 'repeatCount' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation [-Wobjc-property-implementation]
        @implementation CAMediaTiming {
                        ^
        /Applications/Xcode92.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTiming.h:58:17: note: property declared here
        @property float repeatCount;
                ^

* [AVFoundation] Special-case AVCaptureDataOutputSynchronizer[Delegate] in the registrar for macOS.

This class and protocol were incorrectly added to our macOS bindings, but
since we can't remove them because it would break backwards compatibility, we
must skip them manually in the registrar, since the registrar would otherwise
produce uncompilable code:

    In file included from Xamarin.Mac.registrar.full.x86_64.m:2:
    ./Xamarin.Mac.registrar.full.x86_64.h:2929:63: error: 'AVCaptureDataOutputSynchronizerDelegate' is unavailable: not available on macOS
    @interface AVCaptureDataOutputSynchronizerDelegate : NSObject<AVCaptureDataOutputSynchronizerDelegate> {
                                                                  ^
    /Applications/Xcode92.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureDataOutputSynchronizer.h:101:11: note: 'AVCaptureDataOutputSynchronizerDelegate' has been explicitly marked unavailable here
    @protocol AVCaptureDataOutputSynchronizerDelegate <NSObject>
              ^
    In file included from Xamarin.Mac.registrar.mobile.x86_64.m:2:
    ./Xamarin.Mac.registrar.mobile.x86_64.h:3370:63: error: 'AVCaptureDataOutputSynchronizerDelegate' is unavailable: not available on macOS
    @interface AVCaptureDataOutputSynchronizerDelegate : NSObject<AVCaptureDataOutputSynchronizerDelegate> {

* [AVFoundation] Stub out AVCaptureDataOutputSynchronizer[Delegate] on macOS.

AVCaptureDataOutputSynchronizer[Delegate] were incorrectly added to our macOS
bindings, which makes the static registrar's life difficult. So remove those
bindings, and re-implemented them as normal classes, without any attributes,
which makes the static registrar ignore them (to a certain extent: enough to
not generate uncompilable code at least).

* [registrar] Remove more model exclusion code.

* [xtro] Update ignored entries.
This commit is contained in:
Rolf Bjarne Kvinge 2018-02-05 22:19:34 +01:00 коммит произвёл GitHub
Родитель c0202e0e2b
Коммит 9c2010e440
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 90 добавлений и 12 удалений

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

@ -10,6 +10,85 @@ using Foundation;
using ObjCRuntime;
namespace AVFoundation {
#if MONOMAC && XAMCORE_2_0 && !XAMCORE_4_0
[Obsolete ("This API is not available on this platform.")]
public partial class AVCaptureDataOutputSynchronizer : NSObject
{
public override IntPtr ClassHandle { get { throw new PlatformNotSupportedException (); } }
protected AVCaptureDataOutputSynchronizer (NSObjectFlag t) : base (t)
{
throw new PlatformNotSupportedException ();
}
protected internal AVCaptureDataOutputSynchronizer (IntPtr handle) : base (handle)
{
throw new PlatformNotSupportedException ();
}
public AVCaptureDataOutputSynchronizer (AVCaptureOutput[] dataOutputs)
: base (NSObjectFlag.Empty)
{
throw new PlatformNotSupportedException ();
}
public virtual void SetDelegate (IAVCaptureDataOutputSynchronizerDelegate del, global::CoreFoundation.DispatchQueue delegateCallbackQueue)
{
throw new PlatformNotSupportedException ();
}
public virtual AVCaptureOutput[] DataOutputs {
get {
throw new PlatformNotSupportedException ();
}
}
public IAVCaptureDataOutputSynchronizerDelegate Delegate {
get {
throw new PlatformNotSupportedException ();
}
}
public virtual global::CoreFoundation.DispatchQueue DelegateCallbackQueue {
get {
throw new PlatformNotSupportedException ();
}
}
public virtual NSObject WeakDelegate {
get {
throw new PlatformNotSupportedException ();
}
}
}
[Obsolete ("This API is not available on this platform.")]
public interface IAVCaptureDataOutputSynchronizerDelegate : INativeObject, IDisposable
{
void DidOutputSynchronizedDataCollection (AVCaptureDataOutputSynchronizer synchronizer, AVCaptureSynchronizedDataCollection synchronizedDataCollection);
}
[Obsolete ("This API is not available on this platform.")]
public abstract partial class AVCaptureDataOutputSynchronizerDelegate : NSObject, IAVCaptureDataOutputSynchronizerDelegate
{
protected AVCaptureDataOutputSynchronizerDelegate () : base (NSObjectFlag.Empty)
{
throw new PlatformNotSupportedException ();
}
protected AVCaptureDataOutputSynchronizerDelegate (NSObjectFlag t) : base (t)
{
throw new PlatformNotSupportedException ();
}
protected internal AVCaptureDataOutputSynchronizerDelegate (IntPtr handle) : base (handle)
{
throw new PlatformNotSupportedException ();
}
public abstract void DidOutputSynchronizedDataCollection (AVCaptureDataOutputSynchronizer synchronizer, AVCaptureSynchronizedDataCollection synchronizedDataCollection);
}
#endif // MONOMAC && !XAMCORE_4_0
#if !XAMCORE_2_0
partial class AVAssetResourceLoadingDataRequest {

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

@ -3124,9 +3124,7 @@ namespace AVFoundation {
interface IAVCaptureDataOutputSynchronizerDelegate {}
[NoWatch, NoTV, iOS (11,0)]
#if XAMCORE_4_0
[NoMac]
#endif
[Protocol, Model]
[BaseType (typeof(NSObject))]
interface AVCaptureDataOutputSynchronizerDelegate
@ -3137,9 +3135,7 @@ namespace AVFoundation {
}
[NoWatch, NoTV, iOS (11,0)]
#if XAMCORE_4_0
[NoMac]
#endif
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface AVCaptureDataOutputSynchronizer

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

@ -14,10 +14,6 @@
!missing-selector! AVCaptureConnection::setVideoMaxFrameDuration: not bound
!missing-selector! AVCaptureConnection::videoMaxFrameDuration not bound
# Incorrectly bound, fixed for XAMCORE_4_0
!unknown-protocol! AVCaptureDataOutputSynchronizerDelegate bound
!unknown-type! AVCaptureDataOutputSynchronizer bound
## unsorted
!missing-selector! +AVMetadataItem::metadataItemsFromArray:filteredByMetadataItemFilter: not bound

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

@ -2481,7 +2481,7 @@ namespace Registrar {
skip.Clear ();
if (!@class.IsProtocol && !@class.IsModel && !@class.IsCategory) {
if (!@class.IsProtocol && !@class.IsCategory) {
if (!isPlatformType)
customTypeCount++;
@ -2529,9 +2529,6 @@ namespace Registrar {
if (@class.Methods == null && isPlatformType && !@class.IsProtocol && !@class.IsCategory)
continue;
if (@class.IsModel)
continue;
CheckNamespace (@class, exceptions);
if (@class.BaseType != null)
CheckNamespace (@class.BaseType, exceptions);
@ -2691,6 +2688,14 @@ namespace Registrar {
iface.WriteLine ();
if (!is_protocol && !@class.IsWrapper) {
var hasClangDiagnostic = @class.IsModel;
if (hasClangDiagnostic)
sb.WriteLine ("#pragma clang diagnostic push");
if (@class.IsModel) {
sb.WriteLine ("#pragma clang diagnostic ignored \"-Wprotocol\"");
sb.WriteLine ("#pragma clang diagnostic ignored \"-Wobjc-protocol-property-synthesis\"");
sb.WriteLine ("#pragma clang diagnostic ignored \"-Wobjc-property-implementation\"");
}
if (@class.IsCategory) {
sb.WriteLine ("@implementation {0} ({1})", EncodeNonAsciiCharacters (@class.BaseType.ExportedName), @class.CategoryName);
} else {
@ -2717,6 +2722,8 @@ namespace Registrar {
}
sb.Unindent ();
sb.WriteLine ("@end");
if (hasClangDiagnostic)
sb.AppendLine ("#pragma clang diagnostic pop");
}
sb.WriteLine ();
}