Skip to content

Commit

Permalink
Add xtro test for [Deprecated] attributes and fix up usages (#4966)
Browse files Browse the repository at this point in the history
  • Loading branch information
chamons authored Oct 15, 2018
1 parent e8b87b7 commit 1082ce7
Show file tree
Hide file tree
Showing 30 changed files with 620 additions and 33 deletions.
43 changes: 42 additions & 1 deletion src/appkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3731,6 +3731,7 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea
NSColor SelectedControl { get; }

[Static]
[Deprecated (PlatformName.MacOSX, message: "Use 'SelectedContentBackgroundColor' instead.")]
[Export ("secondarySelectedControlColor")]
NSColor SecondarySelectedControl { get; }

Expand Down Expand Up @@ -3821,6 +3822,7 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea
NSColor HeaderText { get; }

[Static]
[Deprecated (PlatformName.MacOSX, message : "Use 'SelectedContentBackgroundColor' instead.")]
[Export ("alternateSelectedControlColor")]
NSColor AlternateSelectedControl { get; }

Expand All @@ -3829,6 +3831,7 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea
NSColor AlternateSelectedControlText { get; }

[Static]
[Advice ("Use 'AlternatingContentBackgroundColors' instead.")]
[Export ("controlAlternatingRowBackgroundColors")]
NSColor [] ControlAlternatingRowBackgroundColors ();

Expand Down Expand Up @@ -5757,6 +5760,7 @@ partial interface NSDocumentController : NSWindowRestoration, NSCoding {
[Export ("runModalOpenPanel:forTypes:")]
nint RunModalOpenPanel (NSOpenPanel openPanel, string [] types);

[Deprecated (PlatformName.MacOSX, 10, 7, message: "Use 'OpenDocument (NSUrl, bool, OpenDocumentCompletionHandler)' instead.")]
[Export ("openDocumentWithContentsOfURL:display:error:")]
NSObject OpenDocument (NSUrl url, bool displayDocument, out NSError outError);

Expand All @@ -5767,6 +5771,7 @@ partial interface NSDocumentController : NSWindowRestoration, NSCoding {
[Export ("makeDocumentWithContentsOfURL:ofType:error:")]
NSObject MakeDocument (NSUrl url, string typeName, out NSError outError);

[Deprecated (PlatformName.MacOSX, 10, 7, message: "Use 'NSDocumentController.ReopenDocumentForUrl (NSUrl, NSUrl, bool, OpenDocumentCompletionHandler)' instead.")]
[Export ("reopenDocumentForURL:withContentsOfURL:error:")]
bool ReopenDocument (NSUrl url, NSUrl contentsUrl, out NSError outError);

Expand Down Expand Up @@ -6790,6 +6795,7 @@ interface NSFontManager : NSMenuItemValidation {
[Export ("sendAction")]
bool SendAction { get; }

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("delegate", ArgumentSemantic.Assign)][NullAllowed]
NSObject WeakDelegate { get; set; }

Expand All @@ -6802,24 +6808,31 @@ interface NSFontManager : NSMenuItemValidation {
[Export ("convertAttributes:")]
NSDictionary ConvertAttributes (NSDictionary attributes);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSFontDescriptor.MatchingFontDescriptors' instead.")]
[Export ("availableFontNamesMatchingFontDescriptor:")]
string [] AvailableFontNamesMatchingFontDescriptor (NSFontDescriptor descriptor);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSFontCollection.AllFontCollectionNames' instead.")]
[Export ("collectionNames")]
string [] CollectionNames { get; }

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSFontCollection.GetMatchingDescriptors ()' instead.")]
[Export ("fontDescriptorsInCollection:")]
NSArray FontDescriptorsInCollection (string collectionNames);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSFontCollection.ShowFontCollection (NSFontCollection, string, NSFontCollectionVisibility, out NSError)' instead.")]
[Export ("addCollection:options:")]
bool AddCollection (string collectionName, NSFontCollectionOptions collectionOptions);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'HideFontCollection (string, NSFontCollectionVisibility, out NSError)' instead.")]
[Export ("removeCollection:")]
bool RemoveCollection (string collectionName);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSMutableFontCollection.AddQueryForDescriptors' instead.")]
[Export ("addFontDescriptors:toCollection:")]
void AddFontDescriptors (NSFontDescriptor [] descriptors, string collectionName);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSMutableFontCollection.RemoveQueryForDescriptors' instead.")]
[Export ("removeFontDescriptor:fromCollection:")]
void RemoveFontDescriptor (NSFontDescriptor descriptor, string collection);

Expand Down Expand Up @@ -7998,13 +8011,16 @@ partial interface NSMenu : NSCoding, NSCopying, NSAccessibility, NSAccessibility
[Export ("size")]
CGSize Size { get; }

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Static]
[Export ("menuZone")]
NSZone MenuZone { get; }

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("helpRequested:")]
void HelpRequested (NSEvent eventPtr);

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("isTornOff")]
bool IsTornOff { get; }

Expand Down Expand Up @@ -8042,6 +8058,7 @@ partial interface NSMenu : NSCoding, NSCopying, NSAccessibility, NSAccessibility
[Export ("showsStateColumn")]
bool ShowsStateColumn { get; set; }

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("menuChangedMessagesEnabled")]
bool MenuChangedMessagesEnabled { get; set; }

Expand Down Expand Up @@ -11919,30 +11936,39 @@ interface NSPrinter : NSCoding, NSCopying {
[Export ("pageSizeForPaper:")]
CGSize PageSizeForPaper (string paperName);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("statusForTable:")]
NSPrinterTableStatus StatusForTable (string tableName);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("isKey:inTable:")]
bool IsKeyInTable (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("booleanForKey:inTable:")]
bool BooleanForKey (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("floatForKey:inTable:")]
float /* float, not CGFloat */ FloatForKey (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("intForKey:inTable:")]
int /* int, not NSInteger */ IntForKey (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("rectForKey:inTable:")]
CGRect RectForKey (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("sizeForKey:inTable:")]
CGSize SizeForKey (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("stringForKey:inTable:")]
string StringForKey (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("stringListForKey:inTable:")]
string [] StringListForKey (string key, string table);

Expand Down Expand Up @@ -14314,7 +14340,7 @@ partial interface NSSound : NSSecureCoding, NSCopying, NSPasteboardReading, NSPa
[Export ("playbackDeviceIdentifier")]
string PlaybackDeviceID { get; set; }

// FIXME: Poor docs, no type defined for the array elements
[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("channelMapping")]
NSObject ChannelMapping { get; set; }
}
Expand Down Expand Up @@ -15942,6 +15968,7 @@ partial interface NSView : NSDraggingDestination, NSAnimatablePropertyContainer,
[Export ("drawPageBorderWithSize:")]
void DrawPageBorder (CGSize borderSize);

[Deprecated (PlatformName.MacOSX, 10, 14, message: "Never called.")]
[Export ("drawSheetBorderWithSize:")]
void DrawSheetBorder (CGSize borderSize);

Expand Down Expand Up @@ -17147,6 +17174,7 @@ interface NSTableViewDataSource {
[Export ("tableView:acceptDrop:row:dropOperation:")]
bool AcceptDrop (NSTableView tableView, [Protocolize (4)] NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation);

[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'NSFilePromiseReceiver' instead.")]
[Export ("tableView:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:")]
string [] FilesDropped (NSTableView tableView, NSUrl dropDestination, NSIndexSet indexSet );

Expand Down Expand Up @@ -18492,6 +18520,7 @@ partial interface NSTextContainer : NSCoding {
[Export ("isSimpleRectangularTextContainer")]
bool IsSimpleRectangularTextContainer { get; }

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("containsPoint:")]
bool ContainsPoint (CGPoint point);

Expand Down Expand Up @@ -18641,6 +18670,7 @@ interface NSTextTab : NSSecureCoding, NSCopying {
interface NSTextInput
{
[Abstract]
[Deprecated (PlatformName.MacOSX, 10, 6)]
[Export ("insertText:")]
void InsertText (NSObject insertString);

Expand Down Expand Up @@ -18756,6 +18786,7 @@ partial interface NSTextView : NSTextInputClient, NSTextLayoutOrientationProvide
[Export ("lowerBaseline:")]
void LowerBaseline (NSObject sender);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use unicode characters via the character palette.")]
[Export ("toggleTraditionalCharacterShape:")]
void ToggleTraditionalCharacterShape (NSObject sender);

Expand Down Expand Up @@ -20340,6 +20371,7 @@ partial interface NSWindow : NSAnimatablePropertyContainer, NSUserInterfaceItemI
[Export ("gState")]
nint GState ();

[Deprecated (PlatformName.MacOSX, 10, 14)]
[Export ("setOneShot:")]
void SetOneShot (bool flag);

Expand Down Expand Up @@ -20415,9 +20447,11 @@ partial interface NSWindow : NSAnimatablePropertyContainer, NSUserInterfaceItemI
[Export ("sharingType")]
NSWindowSharingType SharingType { get; set; }

[Deprecated (PlatformName.MacOSX, 10, 14)]
[Export ("preferredBackingLocation")]
NSWindowBackingLocation PreferredBackingLocation { get; set; }

[Deprecated (PlatformName.MacOSX, 10, 14)]
[Export ("backingLocation")]
NSWindowBackingLocation BackingLocation { get; }

Expand Down Expand Up @@ -21242,6 +21276,7 @@ interface NSWorkspace : NSWorkspaceAccessibilityExtensions {
[Export ("openFile:withApplication:andDeactivate:"), ThreadSafe]
bool OpenFile (string fullPath, [NullAllowed] string appName, bool deactivate);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSWorkspace.OpenUrl' instead.")]
[Export ("openFile:fromImage:at:inView:"), ThreadSafe]
bool OpenFile (string fullPath, NSImage anImage, CGPoint point, NSView aView);

Expand Down Expand Up @@ -21305,6 +21340,7 @@ interface NSWorkspace : NSWorkspaceAccessibilityExtensions {
[Export ("getFileSystemInfoForPath:isRemovable:isWritable:isUnmountable:description:type:"), ThreadSafe]
bool GetFileSystemInfo (string fullPath, out bool removableFlag, out bool writableFlag, out bool unmountableFlag, out string description, out string fileSystemType);

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("performFileOperation:source:destination:files:tag:"), ThreadSafe]
bool PerformFileOperation (NSString workspaceOperation, string source, string destination, string[] files, out nint tag);

Expand All @@ -21320,9 +21356,11 @@ interface NSWorkspace : NSWorkspaceAccessibilityExtensions {
[Export ("hideOtherApplications")]
void HideOtherApplications ();

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("mountedLocalVolumePaths")]
string[] MountedLocalVolumePaths { get; }

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("mountedRemovableMedia")]
string[] MountedRemovableMedia { get; }

Expand All @@ -21342,9 +21380,11 @@ interface NSWorkspace : NSWorkspaceAccessibilityExtensions {
[Export ("openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:"), ThreadSafe]
bool _OpenUrls (NSUrl[] urls, string bundleIdentifier, NSWorkspaceLaunchOptions options, NSAppleEventDescriptor descriptor, [NullAllowed] string[] identifiers);

[Deprecated (PlatformName.MacOSX, 10, 7, message: "Use 'NSWorkspace.RunningApplications' instead.")]
[Export ("launchedApplications")]
NSDictionary [] LaunchedApplications { get; }

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSWorkspace.FrontmostApplication' instead.")]
[Export ("activeApplication")]
NSDictionary ActiveApplication { get; }

Expand Down Expand Up @@ -22263,6 +22303,7 @@ partial interface NSTypesetter {
NSRange GlyphRangeForCharacterRange (NSRange charRange, out NSRange actualCharRange);

// TODO: could use a higher level API
[Deprecated (PlatformName.MacOSX, 10, 13)]
[Export ("getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:")]
nuint GetGlyphsInRange (NSRange glyphsRange, IntPtr glyphBuffer, IntPtr charIndexBuffer, IntPtr inscribeBuffer, IntPtr elasticBuffer, IntPtr bidiLevelBuffer);

Expand Down
18 changes: 17 additions & 1 deletion src/avfoundation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1827,6 +1827,7 @@ interface AVAudioSession {
AVAudioSession SharedInstance ();

[NoWatch]
[Availability (Deprecated = Platform.iOS_6_0, Message = "Use 'AVAudioSession.Notification.Observe*' methods instead.")]
[Export ("delegate", ArgumentSemantic.Assign)][NullAllowed]
[NoTV]
NSObject WeakDelegate { get; set; }
Expand Down Expand Up @@ -2339,6 +2340,7 @@ interface AVAudioSessionRouteChangeEventArgs {
AVAudioSessionRouteDescription PreviousRoute { get; }
}

[Deprecated (PlatformName.iOS, 6, 0)]
[BaseType (typeof (NSObject))]
[Model]
[Protocol]
Expand Down Expand Up @@ -3989,7 +3991,8 @@ interface AVAssetWriter {
void CancelWriting ();

[Export ("finishWriting")]
[Availability (Deprecated = Platform.iOS_6_0, Message = "Use the asynchronous 'FinishWriting (NSAction completionHandler)' instead.")]
[Deprecated (PlatformName.iOS, 6, 0, message: "Use the asynchronous 'FinishWriting (NSAction completionHandler)' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 9, message: "Use the asynchronous 'FinishWriting (NSAction completionHandler)' instead.")]
bool FinishWriting ();

[Mac (10,9)]
Expand Down Expand Up @@ -9412,11 +9415,13 @@ interface AVCapturePhotoOutput
[Export ("livePhotoAutoTrimmingEnabled")]
bool IsLivePhotoAutoTrimmingEnabled { [Bind ("isLivePhotoAutoTrimmingEnabled")] get; set; }

[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'AVCapturePhoto.FileDataRepresentation' instead.")]
[Static]
[Export ("JPEGPhotoDataRepresentationForJPEGSampleBuffer:previewPhotoSampleBuffer:")]
[return: NullAllowed]
NSData GetJpegPhotoDataRepresentation (CMSampleBuffer JPEGSampleBuffer, [NullAllowed] CMSampleBuffer previewPhotoSampleBuffer);

[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'AVCapturePhoto.FileDataRepresentation' instead.")]
[Static]
[Export ("DNGPhotoDataRepresentationForRawSampleBuffer:previewPhotoSampleBuffer:")]
[return: NullAllowed]
Expand Down Expand Up @@ -10298,6 +10303,8 @@ interface AVPlayer {
[Export ("actionAtItemEnd")]
AVPlayerActionAtItemEnd ActionAtItemEnd { get; set; }

[Deprecated (PlatformName.MacOSX, 10, 13)]
[Deprecated (PlatformName.iOS, 11, 0)]
[Export ("closedCaptionDisplayEnabled")]
bool ClosedCaptionDisplayEnabled { [Bind ("isClosedCaptionDisplayEnabled")] get; set; }

Expand Down Expand Up @@ -10713,12 +10720,18 @@ interface AVPlayerItem : NSCopying {
[Export ("stepByCount:")]
void StepByCount (nint stepCount);

[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'Seek (NSDate, AVCompletion)' instead.")]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'Seek (NSDate, AVCompletion)' instead.")]
[Export ("seekToDate:")]
bool Seek (NSDate date);

[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'Seek (CMTime, AVCompletion)' instead.")]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'Seek (CMTime, AVCompletion)' instead.")]
[Export ("seekToTime:")]
void Seek (CMTime time);

[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'Seek (CMTime, CMTime, CMTime, AVCompletion)' instead.")]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'Seek (CMTime, CMTime, CMTime, AVCompletion)' instead.")]
[Export ("seekToTime:toleranceBefore:toleranceAfter:")]
void Seek (CMTime time, CMTime toleranceBefore, CMTime toleranceAfter);

Expand Down Expand Up @@ -10775,6 +10788,8 @@ interface AVPlayerItem : NSCopying {

[return: NullAllowed]
[Mac (10, 8)]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'CurrentMediaSelection' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'CurrentMediaSelection' instead.")]
[Export ("selectedMediaOptionInMediaSelectionGroup:")]
AVMediaSelectionOption SelectedMediaOption (AVMediaSelectionGroup inMediaSelectionGroup);

Expand Down Expand Up @@ -12892,6 +12907,7 @@ interface AVCapturePhoto
NSData FileDataRepresentation { get; }

[iOS (11,0)]
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'GetFileDataRepresentation' instead.")]
[Export ("fileDataRepresentationWithReplacementMetadata:replacementEmbeddedThumbnailPhotoFormat:replacementEmbeddedThumbnailPixelBuffer:replacementDepthData:")]
[return: NullAllowed]
NSData GetFileDataRepresentation ([NullAllowed] NSDictionary<NSString, NSObject> replacementMetadata, [NullAllowed] NSDictionary<NSString, NSObject> replacementEmbeddedThumbnailPhotoFormat, [NullAllowed] CVPixelBuffer replacementEmbeddedThumbnailPixelBuffer, [NullAllowed] AVDepthData replacementDepthData);
Expand Down
5 changes: 4 additions & 1 deletion src/corebluetooth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ interface CBPeripheral : NSCopying {
[Model]
[Protocol]
interface CBPeripheralDelegate {
[Availability (Deprecated=Platform.iOS_8_0, Message="Use 'RssiRead' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 13, message : "Use 'RssiRead' instead.")]
[Deprecated (PlatformName.iOS, 8, 0, message : "Use 'RssiRead' instead.")]
[Export ("peripheralDidUpdateRSSI:error:"), EventArgs ("NSError", true)]
void RssiUpdated (CBPeripheral peripheral, NSError error);

Expand Down Expand Up @@ -636,6 +637,8 @@ interface CBUUID : NSCopying {
CBUUID FromData (NSData theData);

[Availability (Deprecated = Platform.iOS_9_0)]
[Deprecated (PlatformName.MacOSX, 10, 13)]
[Deprecated (PlatformName.iOS, 9, 0)]
[NoWatch]
[Static]
[Export ("UUIDWithCFUUID:")]
Expand Down
Loading

1 comment on commit 1082ce7

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

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

Build was (probably) aborted

🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Build' 🔥 : hudson.AbortException: script returned exit code 2

🔥 Build failed 🔥

Please sign in to comment.