From 3bdd092c4d5503991160e0f95fa5096bab4589a5 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 8 Feb 2021 07:34:02 +0100 Subject: [PATCH] [introspection] Stop hardcoding minimum OS versions. (#10582) * [introspection] Stop hardcoding minimum OS versions. * [src] Remove redundant availability attributes. --- src/MediaToolbox/MTAudioProcessingTap.cs | 1 - src/avfoundation.cs | 2 +- src/corebluetooth.cs | 2 +- src/foundation.cs | 4 ---- src/generator.cs | 2 +- src/uikit.cs | 2 +- tests/introspection/ApiAvailabilityTest.cs | 10 ++++------ tests/introspection/Mac/introspection-mac.csproj | 3 +++ tests/introspection/dotnet/iOS/introspection.csproj | 3 +++ tests/introspection/dotnet/tvOS/introspection.csproj | 3 +++ tests/introspection/iOS/introspection-ios.csproj | 3 +++ 11 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/MediaToolbox/MTAudioProcessingTap.cs b/src/MediaToolbox/MTAudioProcessingTap.cs index 94a0d7584bac..4dcefdd01a37 100644 --- a/src/MediaToolbox/MTAudioProcessingTap.cs +++ b/src/MediaToolbox/MTAudioProcessingTap.cs @@ -43,7 +43,6 @@ namespace MediaToolbox { - [iOS (6,0)][Mac (10,9)] public class MTAudioProcessingTap : INativeObject #if !COREBUILD , IDisposable diff --git a/src/avfoundation.cs b/src/avfoundation.cs index 1cf9a65ce86a..8096f32a16f0 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -3878,7 +3878,7 @@ interface AVAssetResourceLoadingRequest { [Export ("finishLoadingWithResponse:data:redirect:")] [Deprecated (PlatformName.MacOSX, 10, 15, message : "Use the 'Response', 'Redirect' properties and the 'AVAssetResourceLoadingDataRequest.Responds' and 'AVAssetResourceLoadingRequest.FinishLoading' methods instead.")] [Deprecated (PlatformName.TvOS, 9, 0, message : "Use the 'Response', 'Redirect' properties and the 'AVAssetResourceLoadingDataRequest.Responds' and 'AVAssetResourceLoadingRequest.FinishLoading' methods instead.")] - [Availability (Introduced = Platform.iOS_6_0, Deprecated = Platform.iOS_7_0, Message = "Use the 'Response', 'Redirect' properties and the 'AVAssetResourceLoadingDataRequest.Responds' and 'AVAssetResourceLoadingRequest.FinishLoading' methods instead.")] + [Availability (Deprecated = Platform.iOS_7_0, Message = "Use the 'Response', 'Redirect' properties and the 'AVAssetResourceLoadingDataRequest.Responds' and 'AVAssetResourceLoadingRequest.FinishLoading' methods instead.")] void FinishLoading ([NullAllowed] NSUrlResponse usingResponse, [NullAllowed] NSData data, [NullAllowed] NSUrlRequest redirect); [Export ("finishLoadingWithError:")] diff --git a/src/corebluetooth.cs b/src/corebluetooth.cs index de2648907429..6795aa27749a 100644 --- a/src/corebluetooth.cs +++ b/src/corebluetooth.cs @@ -610,7 +610,7 @@ interface CBPeripheralDelegate { [NoTV] [NoWatch] - [Availability (Introduced = Platform.iOS_6_0, Deprecated = Platform.iOS_7_0, Obsoleted = Platform.iOS_8_4)] + [Availability (Deprecated = Platform.iOS_7_0, Obsoleted = Platform.iOS_8_4)] [Export ("peripheralDidInvalidateServices:")] void InvalidatedService (CBPeripheral peripheral); diff --git a/src/foundation.cs b/src/foundation.cs index 93db5832de4c..71f987fdb84c 100644 --- a/src/foundation.cs +++ b/src/foundation.cs @@ -15796,7 +15796,6 @@ interface NSMeasurementFormatter : NSSecureCoding { string ToString (NSUnit unit); } - [Mac (10, 9)][iOS (6, 0)][Watch (2, 0)][TV (9, 0)] [BaseType (typeof (NSObject), Name = "NSXPCConnection")] [DisableDefaultCtor] interface NSXpcConnection @@ -15878,7 +15877,6 @@ interface NSXpcConnection interface INSXpcListenerDelegate {} - [Mac (10, 9)][iOS (6, 0)][Watch (2, 0)][TV (9, 0)] [BaseType (typeof (NSObject), Name = "NSXPCListener", Delegates = new string[] { "WeakDelegate" })] [DisableDefaultCtor] interface NSXpcListener @@ -15925,7 +15923,6 @@ interface NSXpcListenerDelegate } [BaseType (typeof (NSObject), Name = "NSXPCInterface")] - [Mac (10, 9)][iOS (6, 0)][Watch (2, 0)][TV (9, 0)] [DisableDefaultCtor] interface NSXpcInterface { @@ -15945,7 +15942,6 @@ interface NSXpcInterface // Methods taking xpc_type_t have been skipped. } - [iOS (6,0), Watch (2,0), TV (9,0)] [BaseType (typeof (NSObject), Name = "NSXPCListenerEndpoint")] [DisableDefaultCtor] interface NSXpcListenerEndpoint : NSSecureCoding diff --git a/src/generator.cs b/src/generator.cs index 706eb24e73e3..c7b6560fc803 100644 --- a/src/generator.cs +++ b/src/generator.cs @@ -89,7 +89,7 @@ public static Type GetBaseType (Type type, Generator generator) // of [NoiOS] or [NoMac] are applied. // // This needs to merge, because we might have multiple attributes in - // use, for example, the availability (iOS (6,0)) and the fact that this + // use, for example, the availability (iOS (7,0)) and the fact that this // is not available on Mac (NoMac). // public static bool IsUnavailable (this ICustomAttributeProvider provider, Generator generator) diff --git a/src/uikit.cs b/src/uikit.cs index ecf2ed825d09..e8a804113d37 100644 --- a/src/uikit.cs +++ b/src/uikit.cs @@ -8585,7 +8585,7 @@ interface UILabel : UIContentSizeCategoryAdjusting { [NoTV] [Export ("adjustsLetterSpacingToFitWidth")] - [Availability (Introduced = Platform.iOS_6_0, Deprecated = Platform.iOS_7_0, Message = "Use 'NSKernAttributeName' instead.")] + [Availability (Deprecated = Platform.iOS_7_0, Message = "Use 'NSKernAttributeName' instead.")] bool AdjustsLetterSpacingToFitWidth { get; set; } [Export ("minimumScaleFactor")] diff --git a/tests/introspection/ApiAvailabilityTest.cs b/tests/introspection/ApiAvailabilityTest.cs index 0aba35bfd3a0..4c3de4379a1a 100644 --- a/tests/introspection/ApiAvailabilityTest.cs +++ b/tests/introspection/ApiAvailabilityTest.cs @@ -38,18 +38,16 @@ public ApiAvailabilityTest () Maximum = Version.Parse (Constants.SdkVersion); #if __IOS__ Platform = PlatformName.iOS; - Minimum = new Version (6,0); + Minimum = Xamarin.SdkVersions.MiniOSVersion; #elif __TVOS__ Platform = PlatformName.TvOS; - Minimum = new Version (9,0); + Minimum = Xamarin.SdkVersions.MinTVOSVersion; #elif __WATCHOS__ Platform = PlatformName.WatchOS; - Minimum = new Version (2,0); - // Need to special case watchOS 'Maximum' version for OS minor subversions (can't change Constants.SdkVersion) - //Maximum = new Version (6,2,5); + Minimum = Xamarin.SdkVersions.MinWatchOSVersion; #else Platform = PlatformName.MacOSX; - Minimum = new Version (10,9); + Minimum = Xamarin.SdkVersions.MinOSXVersion; // Need to special case macOS 'Maximum' version for OS minor subversions (can't change Constants.SdkVersion) // Please comment the code below if needed Maximum = new Version (11,1,0); diff --git a/tests/introspection/Mac/introspection-mac.csproj b/tests/introspection/Mac/introspection-mac.csproj index 3164b07ae2f5..28e20bcd5e12 100644 --- a/tests/introspection/Mac/introspection-mac.csproj +++ b/tests/introspection/Mac/introspection-mac.csproj @@ -136,6 +136,9 @@ Frameworks.cs + + SdkVersions.cs + ApiFrameworkTest.cs diff --git a/tests/introspection/dotnet/iOS/introspection.csproj b/tests/introspection/dotnet/iOS/introspection.csproj index f7b179f9966c..eb743610df5d 100644 --- a/tests/introspection/dotnet/iOS/introspection.csproj +++ b/tests/introspection/dotnet/iOS/introspection.csproj @@ -109,6 +109,9 @@ ApplePlatform.cs + + SdkVersions.cs + ApiFrameworkTest.cs diff --git a/tests/introspection/dotnet/tvOS/introspection.csproj b/tests/introspection/dotnet/tvOS/introspection.csproj index be79d0af8db9..4dfa0116598d 100644 --- a/tests/introspection/dotnet/tvOS/introspection.csproj +++ b/tests/introspection/dotnet/tvOS/introspection.csproj @@ -106,6 +106,9 @@ ApplePlatform.cs + + SdkVersions.cs + ApiFrameworkTest.cs diff --git a/tests/introspection/iOS/introspection-ios.csproj b/tests/introspection/iOS/introspection-ios.csproj index 12e6132c92c7..3fd5ad34e333 100644 --- a/tests/introspection/iOS/introspection-ios.csproj +++ b/tests/introspection/iOS/introspection-ios.csproj @@ -230,6 +230,9 @@ Frameworks.cs + + SdkVersions.cs + ApiFrameworkTest.cs