Skip to content

Commit

Permalink
[generator] tvOS attributes aren't implied from iOS attributes. (dotn…
Browse files Browse the repository at this point in the history
…et#17057)

This hasn't been a problem until now because we've always had tvOS attributes on
most API, but when bumping min OS versions for .NET 8, we'll also remove a lot of
redundant availability attributes. This would break a case where a type is unavailable
on all platforms except tvOS (but without any tvOS availability attribute), and then
we'd get the (implied) iOS (un)availability attribute.
  • Loading branch information
rolfbjarne authored Dec 20, 2022
1 parent e10e5e5 commit a227b77
Show file tree
Hide file tree
Showing 28 changed files with 136 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/CoreGraphics/CGEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public enum CGTextDrawingMode : uint {

// untyped enum -> CGContext.h
[Deprecated (PlatformName.iOS, 7, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[Deprecated (PlatformName.MacOSX, 10, 9)]
public enum CGTextEncoding {
FontSpecific,
Expand Down
1 change: 1 addition & 0 deletions src/Foundation/Enum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ public enum NSCalendarUnit : ulong {
Second = 128,
[Deprecated (PlatformName.MacOSX, 10, 10)]
[Deprecated (PlatformName.iOS, 8, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
Week = 256,
Weekday = 512,
WeekdayOrdinal = 1024,
Expand Down
5 changes: 5 additions & 0 deletions src/GameKit/GameKit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public enum GKPeerPickerConnectionType : ulong {
// untyped enum -> GKPublicConstants.h
[NoMac]
[Deprecated (PlatformName.iOS, 7, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[ErrorDomain ("GKVoiceChatServiceErrorDomain")]
public enum GKVoiceChatServiceError {
Internal = 32000,
Expand All @@ -57,6 +58,7 @@ public enum GKVoiceChatServiceError {

// untyped enum -> GKPublicConstants.h
[Deprecated (PlatformName.iOS, 7, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[Deprecated (PlatformName.MacOSX, 10, 10)]
public enum GKSendDataMode {
Reliable,
Expand All @@ -65,6 +67,7 @@ public enum GKSendDataMode {

// untyped enum -> GKPublicConstants.h
[Deprecated (PlatformName.iOS, 7, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[Deprecated (PlatformName.MacOSX, 10, 10)]
public enum GKSessionMode {
Server,
Expand All @@ -74,6 +77,7 @@ public enum GKSessionMode {

// untyped enum -> GKPublicConstants.h
[Deprecated (PlatformName.iOS, 7, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[Deprecated (PlatformName.MacOSX, 10, 10)]
public enum GKPeerConnectionState {
Available,
Expand Down Expand Up @@ -196,6 +200,7 @@ public enum GKGameSessionErrorCode : long {

// NSInteger -> GKMatch.h
[Deprecated (PlatformName.iOS, 7, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[Deprecated (PlatformName.MacOSX, 10, 10)]
[Native]
public enum GKMatchSendDataMode : long {
Expand Down
1 change: 1 addition & 0 deletions src/Security/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ public enum SecTrustResult {
Proceed,

[Deprecated (PlatformName.iOS, 7, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[Deprecated (PlatformName.MacOSX, 10, 9)]
Confirm,
Deny,
Expand Down
4 changes: 4 additions & 0 deletions src/UIKit/UIEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public enum UIBarButtonItemStyle : long {
Plain,

[Deprecated (PlatformName.iOS, 8, 0, message: "Use 'UIBarButtonItemStyle.Plain' instead.")]
[Deprecated (PlatformName.TvOS, 9, 0, message: "Use 'UIBarButtonItemStyle.Plain' instead.")]
Bordered,

Done,
Expand Down Expand Up @@ -97,6 +98,7 @@ public enum UIBarButtonSystemItem : long {
Undo,
Redo,
[Deprecated (PlatformName.iOS, 11, 0)]
[Deprecated (PlatformName.TvOS, 11, 0)]
PageCurl,
[iOS (13, 0), NoTV]
Close,
Expand Down Expand Up @@ -287,9 +289,11 @@ public enum UIBarMetrics : long {
CompactPrompt,

[Deprecated (PlatformName.iOS, 8, 0, message: "Use 'UIBarMetrics.Compat' instead.")]
[Deprecated (PlatformName.TvOS, 9, 0, message: "Use 'UIBarMetrics.Compat' instead.")]
LandscapePhone = Compact,

[Deprecated (PlatformName.iOS, 8, 0, message: "Use 'UIBarMetrics.CompactPrompt' instead.")]
[Deprecated (PlatformName.TvOS, 9, 0, message: "Use 'UIBarMetrics.CompactPrompt' instead.")]
LandscapePhonePrompt = CompactPrompt
}

Expand Down
2 changes: 1 addition & 1 deletion src/authenticationservices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public enum ASExtensionErrorCode : long {
[Partial]
interface ASExtensionErrorCodeExtensions {

#if TVOS || WATCH
#if NET || TVOS || WATCH
// Type `ASExtensionErrorCode` is already decorated, so it becomes a duplicate (after code gen)
// on those platforms and intro tests complains (on other platforms, e.g. iOS, Catalyst)
// OTOH if we don't add them here then we'll get the extra, not really usable, extension type
Expand Down
5 changes: 5 additions & 0 deletions src/avfoundation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1711,16 +1711,19 @@ interface AVAudioPlayerDelegate {

[NoMac]
[Deprecated (PlatformName.iOS, 8, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[Export ("audioPlayerBeginInterruption:")]
void BeginInterruption (AVAudioPlayer player);

[NoMac]
[Export ("audioPlayerEndInterruption:")]
[Deprecated (PlatformName.iOS, 6, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
void EndInterruption (AVAudioPlayer player);

[NoMac]
[Deprecated (PlatformName.iOS, 8, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[Export ("audioPlayerEndInterruption:withOptions:")]
#if NET
void EndInterruption (AVAudioPlayer player, AVAudioSessionInterruptionOptions flags);
Expand Down Expand Up @@ -5661,6 +5664,7 @@ interface AVMetadata {
NSString ID3MetadataKeyCommercial { get; }

[Deprecated (PlatformName.iOS, 9, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[Deprecated (PlatformName.MacOSX, 10, 11)]
[Field ("AVMetadataID3MetadataKeyCommerical")]
NSString ID3MetadataKeyCommerical { get; }
Expand Down Expand Up @@ -6633,6 +6637,7 @@ interface ID3Metadata {

[iOS (8, 0)]
[Deprecated (PlatformName.iOS, 9, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[Mac (10, 10)]
[Deprecated (PlatformName.MacOSX, 10, 11)]
[Field ("AVMetadataIdentifierID3MetadataCommerical")]
Expand Down
4 changes: 4 additions & 0 deletions src/cloudkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ interface CKContainer {

[NoWatch]
[Deprecated (PlatformName.iOS, 10, 0, message: "Use 'CurrentUserDefaultName' instead.")]
[Deprecated (PlatformName.TvOS, 10, 0, message: "Use 'CurrentUserDefaultName' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 12, message: "Use 'CurrentUserDefaultName' instead.")]
[Field ("CKOwnerDefaultName")]
NSString OwnerDefaultName { get; }
Expand Down Expand Up @@ -1726,13 +1727,15 @@ interface CKSubscription : NSSecureCoding, NSCopying {

[NoWatch]
[Deprecated (PlatformName.iOS, 10, 0, message: "Use 'CKQuerySubscription'.")]
[Deprecated (PlatformName.TvOS, 10, 0, message: "Use 'CKQuerySubscription'.")]
[Deprecated (PlatformName.MacOSX, 10, 12, message: "Use 'CKQuerySubscription'.")]
[NullAllowed]
[Export ("recordType")]
string RecordType { get; }

[NoWatch]
[Deprecated (PlatformName.iOS, 10, 0, message: "Use 'CKQuerySubscription'.")]
[Deprecated (PlatformName.TvOS, 10, 0, message: "Use 'CKQuerySubscription'.")]
[Deprecated (PlatformName.MacOSX, 10, 12, message: "Use 'CKQuerySubscription'.")]
[NullAllowed]
[Export ("predicate", ArgumentSemantic.Copy)]
Expand All @@ -1745,6 +1748,7 @@ interface CKSubscription : NSSecureCoding, NSCopying {

[NoWatch]
[Deprecated (PlatformName.iOS, 10, 0, message: "Use 'CKRecordZoneSubscription'.")]
[Deprecated (PlatformName.TvOS, 10, 0, message: "Use 'CKRecordZoneSubscription'.")]
[Deprecated (PlatformName.MacOSX, 10, 12, message: "Use 'CKRecordZoneSubscription'.")]
[NoMacCatalyst]
[NullAllowed]
Expand Down
4 changes: 4 additions & 0 deletions src/corebluetooth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ interface CBCharacteristic {
CBDescriptor [] Descriptors { get; [NotImplemented ("Not available on CBCharacteristic, only available on CBMutableCharacteristic")] set; }

[Deprecated (PlatformName.iOS, 8, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[Deprecated (PlatformName.MacOSX, 10, 13)]
[Export ("isBroadcasted")]
bool IsBroadcasted { get; }
Expand Down Expand Up @@ -507,6 +508,7 @@ interface CBPeripheral : NSCopying {
string Name { get; }

[Deprecated (PlatformName.iOS, 8, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[Deprecated (PlatformName.MacOSX, 10, 13)]
[NoWatch]
[Export ("RSSI", ArgumentSemantic.Retain)]
Expand Down Expand Up @@ -596,6 +598,7 @@ interface CBPeripheral : NSCopying {
interface CBPeripheralDelegate {
[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'RssiRead' instead.")]
[Deprecated (PlatformName.iOS, 8, 0, message: "Use 'RssiRead' instead.")]
[Deprecated (PlatformName.TvOS, 9, 0, message: "Use 'RssiRead' instead.")]
[Export ("peripheralDidUpdateRSSI:error:"), EventArgs ("NSError", true)]
void RssiUpdated (CBPeripheral peripheral, [NullAllowed] NSError error);

Expand Down Expand Up @@ -733,6 +736,7 @@ interface CBUUID : NSCopying {

[Deprecated (PlatformName.MacOSX, 10, 13)]
[Deprecated (PlatformName.iOS, 9, 0)]
[Deprecated (PlatformName.TvOS, 9, 0)]
[NoWatch]
[Static]
[Export ("UUIDWithCFUUID:")]
Expand Down
4 changes: 4 additions & 0 deletions src/coredata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,7 @@ interface NSManagedObjectContext : NSCoding
#endif
{
[Deprecated (PlatformName.iOS, 9, 0, message: "Use 'NSManagedObjectContext (NSManagedObjectContextConcurrencyType)' instead.")]
[Deprecated (PlatformName.TvOS, 9, 0, message: "Use 'NSManagedObjectContext (NSManagedObjectContextConcurrencyType)' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSManagedObjectContext (NSManagedObjectContextConcurrencyType)' instead.")]
[Export ("init")]
NativeHandle Constructor ();
Expand Down Expand Up @@ -1976,6 +1977,7 @@ partial interface NSPersistentStoreCoordinator
void RegisterStoreClass ([NullAllowed] Class storeClass, NSString storeType);

[Deprecated (PlatformName.iOS, 9, 0, message: "Use the method that takes an out NSError parameter.")]
[Deprecated (PlatformName.TvOS, 9, 0, message: "Use the method that takes an out NSError parameter.")]
[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use the method that takes an out NSError parameter.")]
[Static, Export ("metadataForPersistentStoreOfType:URL:error:")]
[return: NullAllowed]
Expand All @@ -1987,6 +1989,7 @@ partial interface NSPersistentStoreCoordinator
NSDictionary<NSString, NSObject> GetMetadata (string storeType, NSUrl url, [NullAllowed] NSDictionary options, out NSError error);

[Deprecated (PlatformName.iOS, 9, 0, message: "Use the method that takes an 'out NSError' parameter.")]
[Deprecated (PlatformName.TvOS, 9, 0, message: "Use the method that takes an 'out NSError' parameter.")]
[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use the method that takes an 'out NSError' parameter.")]
[Static, Export ("setMetadata:forPersistentStoreOfType:URL:error:")]
bool SetMetadata ([NullAllowed] NSDictionary metadata, [NullAllowed] NSString storeType, NSUrl url, out NSError error);
Expand Down Expand Up @@ -2437,6 +2440,7 @@ interface NSPropertyDescription : NSCoding, NSCopying {

[Export ("storedInExternalRecord")]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'CoreSpotlight' integration instead.")]
[Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'CoreSpotlight' integration instead.")]
[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'CoreSpotlight' integration instead.")]
bool StoredInExternalRecord { [Bind ("isStoredInExternalRecord")] get; set; }
}
Expand Down
9 changes: 9 additions & 0 deletions src/coreimage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,14 @@ interface CIContext {
#if HAS_OPENGLES
[NoMac][NoMacCatalyst]
[Deprecated (PlatformName.iOS, 12, 0)]
[Deprecated (PlatformName.TvOS, 12, 0)]
[Static]
[Export ("contextWithEAGLContext:")]
CIContext FromContext (EAGLContext eaglContext);

[NoMac][NoMacCatalyst]
[Deprecated (PlatformName.iOS, 12, 0)]
[Deprecated (PlatformName.TvOS, 12, 0)]
[Static]
[Export ("contextWithEAGLContext:options:")]
CIContext FromContext (EAGLContext eaglContext, [NullAllowed] NSDictionary dictionary);
Expand Down Expand Up @@ -315,6 +317,7 @@ interface CIContext {
void Render (CIImage image, IMTLTexture texture, [NullAllowed] IMTLCommandBuffer commandBuffer, CGRect bounds, CGColorSpace colorSpace);

[Deprecated (PlatformName.iOS, 6, 0, message: "Use 'DrawImage (image, CGRect, CGRect)' instead.")]
[Deprecated (PlatformName.TvOS, 9, 0, message: "Use 'DrawImage (image, CGRect, CGRect)' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 8, message: "Use 'DrawImage (image, CGRect, CGRect)' instead.")]
[Export ("drawImage:atPoint:fromRect:")]
void DrawImage (CIImage image, CGPoint atPoint, CGRect fromRect);
Expand Down Expand Up @@ -1813,6 +1816,7 @@ interface CIImage : NSSecureCoding, NSCopying {
CIImage FromData (NSData bitmapData, nint bytesPerRow, CGSize size, int /* CIFormat = int */ pixelFormat, [NullAllowed] CGColorSpace colorSpace);

[Deprecated (PlatformName.iOS, 12, 0)]
[Deprecated (PlatformName.TvOS, 12, 0)]
[Deprecated (PlatformName.MacOSX, 10, 14)]
[Static]
[Export ("imageWithTexture:size:flipped:colorSpace:")]
Expand Down Expand Up @@ -2731,12 +2735,14 @@ interface CIKernel {
CIKernel [] FromMetalSource (string source, [NullAllowed] out NSError error);

[Deprecated (PlatformName.iOS, 12, 0)]
[Deprecated (PlatformName.TvOS, 12, 0)]
[Deprecated (PlatformName.MacOSX, 10, 14)]
[Static, Export ("kernelsWithString:")]
[return: NullAllowed]
CIKernel [] FromProgramMultiple (string coreImageShaderProgram);

[Deprecated (PlatformName.iOS, 12, 0)]
[Deprecated (PlatformName.TvOS, 12, 0)]
[Deprecated (PlatformName.MacOSX, 10, 14)]
[Static, Export ("kernelWithString:")]
[return: NullAllowed]
Expand Down Expand Up @@ -2793,6 +2799,7 @@ interface CIColorKernel {
// Note: the API is supported in iOS 8, but with iOS 9, they guarantee
// a more derived result
[Deprecated (PlatformName.iOS, 12, 0)]
[Deprecated (PlatformName.TvOS, 12, 0)]
[Deprecated (PlatformName.MacOSX, 10, 14)]
[New, Static, Export ("kernelWithString:")]
[return: NullAllowed]
Expand All @@ -2811,6 +2818,7 @@ interface CIWarpKernel {
// Note: the API is supported in iOS 8, but with iOS 9, they guarantee
// a more derived result
[Deprecated (PlatformName.iOS, 12, 0)]
[Deprecated (PlatformName.TvOS, 12, 0)]
[Deprecated (PlatformName.MacOSX, 10, 14)]
[New, Static, Export ("kernelWithString:")]
[return: NullAllowed]
Expand Down Expand Up @@ -5968,6 +5976,7 @@ interface CIDataMatrixCodeDescriptor {
interface CIBlendKernel {

[Deprecated (PlatformName.iOS, 12, 0)]
[Deprecated (PlatformName.TvOS, 12, 0)]
[Deprecated (PlatformName.MacOSX, 10, 14)]
[Static]
[Export ("kernelWithString:")]
Expand Down
2 changes: 2 additions & 0 deletions src/corelocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ partial interface CLRegion : NSSecureCoding, NSCopying {
interface CLPlacemark : NSSecureCoding, NSCopying {
[Deprecated (PlatformName.WatchOS, 4, 0, message: "Use 'CLPlacemark' properties to access data.")]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'CLPlacemark' properties to access data.")]
[Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'CLPlacemark' properties to access data.")]
[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'CLPlacemark' properties to access data.")]
[NullAllowed, Export ("addressDictionary", ArgumentSemantic.Copy)]
NSDictionary AddressDictionary { get; }
Expand Down Expand Up @@ -886,6 +887,7 @@ interface CLGeocoder {

[Deprecated (PlatformName.WatchOS, 4, 0, message: "Use 'GeocodeAddress (string, CLRegion, NSLocale, CLGeocodeCompletionHandler)' instead.")]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'GeocodeAddress (string, CLRegion, NSLocale, CLGeocodeCompletionHandler)' instead.")]
[Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'GeocodeAddress (string, CLRegion, NSLocale, CLGeocodeCompletionHandler)' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'GeocodeAddress (string, CLRegion, NSLocale, CLGeocodeCompletionHandler)' instead.")]
[Export ("geocodeAddressDictionary:completionHandler:")]
[Async]
Expand Down
2 changes: 2 additions & 0 deletions src/corevideo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,14 @@ enum CVImageBufferYCbCrMatrix {
Smpte240M1995,

[Deprecated (PlatformName.iOS, 14, 0, message: "This API is no longer supported.")]
[Deprecated (PlatformName.TvOS, 14, 0, message: "This API is no longer supported.")]
[Deprecated (PlatformName.MacOSX, 11, 0, message: "This API is no longer supported.")]
[Field ("kCVImageBufferYCbCrMatrix_DCI_P3")]
[iOS (9, 0), Mac (10, 12)]
DciP3,

[Deprecated (PlatformName.iOS, 14, 0, message: "This API is no longer supported.")]
[Deprecated (PlatformName.TvOS, 14, 0, message: "This API is no longer supported.")]
[Deprecated (PlatformName.MacOSX, 11, 0, message: "This API is no longer supported.")]
[Field ("kCVImageBufferYCbCrMatrix_P3_D65")]
[iOS (9, 0), Mac (10, 12)]
Expand Down
Loading

0 comments on commit a227b77

Please sign in to comment.