From 0b4fc12f322c6660a9a0636776edc9dd233bc7d5 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 6 Sep 2019 17:57:40 -0700 Subject: [PATCH] [tests] Fix several issues that show up in the mtouch and introspection tests on macOS 10.15. (#6929) * [introspection] Fix several issues that show up on macOS 10.15. * [tests][mtouch] Fix a few tests according to recent changes. --- src/Photos/PHCompat.cs | 12 ++++++------ src/Security/Items.cs | 4 ++-- src/avfoundation.cs | 4 ++-- src/gamekit.cs | 2 +- tests/common/ProductTests.cs | 3 +-- tests/introspection/ApiTypoTest.cs | 11 +++++++++++ tests/introspection/Mac/MacApiProtocolTest.cs | 5 +++++ tests/introspection/Mac/MacApiSelectorTest.cs | 19 +++++++++++++++++++ tests/mtouch/MTouch.cs | 14 +++++++------- tools/mtouch/BuildTasks.mtouch.cs | 3 ++- 10 files changed, 56 insertions(+), 21 deletions(-) diff --git a/src/Photos/PHCompat.cs b/src/Photos/PHCompat.cs index 27ba72bc3b..d93551910f 100644 --- a/src/Photos/PHCompat.cs +++ b/src/Photos/PHCompat.cs @@ -40,14 +40,14 @@ namespace Photos { #if MONOMAC public partial class PHAssetCollection { - [Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11")] + [Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11.")] [Unavailable (PlatformName.MacOSX)] public static PHFetchResult FetchMoments (PHFetchOptions options) { return null; } - [Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11")] + [Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11.")] [Unavailable (PlatformName.MacOSX)] public static PHFetchResult FetchMoments (PHCollectionList momentList, PHFetchOptions options) { @@ -57,14 +57,14 @@ namespace Photos { public partial class PHCollectionList { - [Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11")] + [Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11.")] [Unavailable (PlatformName.MacOSX)] public static PHFetchResult FetchMomentLists (PHCollectionListSubtype subType, PHFetchOptions options) { return null; } - [Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11")] + [Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11.")] [Unavailable (PlatformName.MacOSX)] public static PHFetchResult FetchMomentLists (PHCollectionListSubtype subType, PHAssetCollection moment, PHFetchOptions options) { @@ -74,7 +74,7 @@ namespace Photos { public partial class PHContentEditingInput { - [Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11")] + [Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11.")] [Unavailable (PlatformName.MacOSX, message: "Use 'AudiovisualAsset' instead.")] public virtual AVFoundation.AVAsset AvAsset { get { return AudiovisualAsset; } @@ -85,7 +85,7 @@ namespace Photos { public partial class PHImageManager { - [Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11")] + [Obsolete ("Compatibility stub - This was marked as unavailable on macOS with Xcode 11.")] [Unavailable (PlatformName.MacOSX, message: "Use 'RequestImageDataAndOrientation (PHAsset asset, [NullAllowed] PHImageRequestOptions options, PHImageManagerRequestImageDataHandler resultHandler)' instead.")] public virtual int RequestImageData (PHAsset asset, PHImageRequestOptions options, PHImageDataHandler handler) { diff --git a/src/Security/Items.cs b/src/Security/Items.cs index 7d41380da2..56a341e439 100644 --- a/src/Security/Items.cs +++ b/src/Security/Items.cs @@ -55,12 +55,12 @@ namespace Security { Invalid = -1, WhenUnlocked, AfterFirstUnlock, - [Deprecated (PlatformName.MacOSX, 10,14, message: "Use 'AfterFirstUnlock' or a better suited option instead.'")] + [Deprecated (PlatformName.MacOSX, 10,14, message: "Use 'AfterFirstUnlock' or a better suited option instead.")] [Deprecated (PlatformName.iOS, 12,0, message: "Use 'AfterFirstUnlock' or a better suited option instead.")] Always, WhenUnlockedThisDeviceOnly, AfterFirstUnlockThisDeviceOnly, - [Deprecated (PlatformName.MacOSX, 10,14, message: "Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.'")] + [Deprecated (PlatformName.MacOSX, 10,14, message: "Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.")] [Deprecated (PlatformName.iOS, 12,0, message: "Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.")] AlwaysThisDeviceOnly, WhenPasscodeSetThisDeviceOnly diff --git a/src/avfoundation.cs b/src/avfoundation.cs index 86c0229c10..f815acde72 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -7659,7 +7659,7 @@ namespace AVFoundation { [TV (13,0), NoWatch, Mac (10,15), iOS (13,0)] [Field ("AVAssetExportPresetHEVCHighestQualityWithAlpha")] - NSString PresetHevchHighestQualityWithAlpha { get; } + NSString PresetHevcHighestQualityWithAlpha { get; } // 5.0 APIs [Export ("asset", ArgumentSemantic.Retain)] @@ -13296,7 +13296,7 @@ namespace AVFoundation { [NullAllowed, Export ("fileDataRepresentation")] NSData FileDataRepresentation { get; } - [iOS (11,0)] + [iOS (11,0), NoMac] [Deprecated (PlatformName.iOS, 12, 0, message: "Use 'GetFileDataRepresentation' instead.")] [Export ("fileDataRepresentationWithReplacementMetadata:replacementEmbeddedThumbnailPhotoFormat:replacementEmbeddedThumbnailPixelBuffer:replacementDepthData:")] [return: NullAllowed] diff --git a/src/gamekit.cs b/src/gamekit.cs index b303fad71b..35c333d655 100644 --- a/src/gamekit.cs +++ b/src/gamekit.cs @@ -839,7 +839,7 @@ namespace GameKit { [TV (13,0)][Mac (10,15)][iOS (13,0)][Watch (6,0)] [Export ("loadChallengableFriendsWithCompletionHandler:")] [Async] - void LoadChallengableFriends ([NullAllowed] Action completionHandler); + void LoadChallengeableFriends ([NullAllowed] Action completionHandler); [NoWatch] [TV (13,0)][Mac (10,15)][iOS (13,0)] diff --git a/tests/common/ProductTests.cs b/tests/common/ProductTests.cs index 129d67fcbf..1a96dabb08 100644 --- a/tests/common/ProductTests.cs +++ b/tests/common/ProductTests.cs @@ -134,8 +134,7 @@ namespace Xamarin.Tests break; case MachO.LoadCommands.MinwatchOS: version = SdkVersions.MinWatchOSVersion; - if (device) - alternate_version = new Version (5, 1, 0); // arm64_32 has min OS 5.1 + alternate_version = new Version (5, 1, 0); // arm64_32 has min OS 5.1 mono_native_compat_version = SdkVersions.MinWatchOSVersion; mono_native_unified_version = new Version (5, 0, 0); if (device) diff --git a/tests/introspection/ApiTypoTest.cs b/tests/introspection/ApiTypoTest.cs index ec7253e443..3f3c1c0fc5 100644 --- a/tests/introspection/ApiTypoTest.cs +++ b/tests/introspection/ApiTypoTest.cs @@ -88,14 +88,17 @@ namespace Introspection "Addl", "Addr", "Adjustmentfor", + "Aes", // Advanced Encryption Standard "Aifc", "Aiff", + "Agc", "Aio", "Alg", // short for Algorithm "Alpn", // Application-Layer Protocol Negotiation RFC7301 "Amete", "Amr", "Anglet", + "Apng", // Animated Portable Network Graphics "Aps", "Arraycollation", "Argb", @@ -107,6 +110,7 @@ namespace Introspection "Attrs", // Attributes (used by Apple for keys) "Audiofile", "Automapping", + "Automatch", "Automounted", "Autoredirect", "Autospace", @@ -144,6 +148,7 @@ namespace Introspection "Characterteristic", "Chapv", "Cholesky", + "Chacha", "Chromaticities", "Ciexyz", "Ciff", @@ -200,6 +205,7 @@ namespace Introspection "Ebu", "Ecc", // Elliptic Curve Cryptography "Ecdh", // Elliptic Curve Diffie–Hellman + "Ecdhe", // Elliptic Curve Diffie-Hellman Ephemeral "Ecdsa", // Elliptic Curve Digital Signature Algorithm "Ecies", // Elliptic Curve Integrated Encryption Scheme "Ecn", // Explicit Congestion Notification @@ -250,6 +256,7 @@ namespace Introspection "Greeking", "Gtin", "Hardlink", + "Heics", // High Efficiency Image File Format (Sequence) "Hdmi", "Hdr", "Hectopascals", @@ -386,6 +393,7 @@ namespace Introspection "Nyquist", "Oaep", // Optimal asymmetric encryption padding "Objectfor", + "Objectness", "Occlussion", "Ocurrences", "Ocsp", // Online Certificate Status Protocol @@ -514,7 +522,10 @@ namespace Introspection "th", "Threadgroup", "Threadgroups", + "Thumbnailing", "Thumbstick", + "Thumbsticks", + "Timecodes", "Timelapse", "Timelapses", "Tls", diff --git a/tests/introspection/Mac/MacApiProtocolTest.cs b/tests/introspection/Mac/MacApiProtocolTest.cs index f67b0e02f5..1341f9fb61 100644 --- a/tests/introspection/Mac/MacApiProtocolTest.cs +++ b/tests/introspection/Mac/MacApiProtocolTest.cs @@ -83,6 +83,8 @@ namespace Introspection { case "MLPredictionOptions": // Conformance not in headers case "NSUrlSessionTaskMetrics": // Conformance not in headers case "NSUrlSessionTaskTransactionMetrics": // Conformance not in headers + case "NSFileProviderDomain": // Conformance not in headers + case "FPUIActionExtensionContext": // Conformance not in headers return true; #if !UNIFIED // existing classic/old binary is not updated @@ -118,6 +120,7 @@ namespace Introspection { // Xcode 11 (running on macOS 10.15) case "NSCollectionViewUpdateItem": // Not declared in header file case "MLPredictionOptions": // Not declared in header file + case "FPUIActionExtensionContext": // Conformance not in headers return true; } break; @@ -176,6 +179,8 @@ namespace Introspection { case "MLPredictionOptions": // Conformance not in headers case "NSUrlSessionTaskMetrics": // Conformance not in headers case "NSUrlSessionTaskTransactionMetrics": // Conformance not in headers + case "NSFileProviderDomain": // Conformance not in headers + case "FPUIActionExtensionContext": // Conformance not in headers return true; } break; diff --git a/tests/introspection/Mac/MacApiSelectorTest.cs b/tests/introspection/Mac/MacApiSelectorTest.cs index 444b19fda1..9a6663d692 100644 --- a/tests/introspection/Mac/MacApiSelectorTest.cs +++ b/tests/introspection/Mac/MacApiSelectorTest.cs @@ -675,6 +675,25 @@ namespace Introspection { break; } break; + case "AVFoundation": + switch (type.Name) { + case "AVCapturePhoto": + switch (selectorName) { + case "fileDataRepresentationWithReplacementMetadata:replacementEmbeddedThumbnailPhotoFormat:replacementEmbeddedThumbnailPixelBuffer:replacementDepthData:": + // This method was mistakenly bound in macOS. + return true; + } + break; + case "AVSpeechSynthesisVoice": + switch (selectorName) { + case "gender": + // Selector not there: https://github.com/xamarin/maccore/issues/1949 + return true; + } + break; + break; + } + break; } return base.Skip (type, selectorName); } diff --git a/tests/mtouch/MTouch.cs b/tests/mtouch/MTouch.cs index 471cf7004f..c1630df836 100644 --- a/tests/mtouch/MTouch.cs +++ b/tests/mtouch/MTouch.cs @@ -279,7 +279,7 @@ public class B : A {} mtouch.CreateTemporaryCacheDirectory (); mtouch.Abi = abi; mtouch.Debug = debug; - mtouch.TargetVer = "6.0"; + mtouch.TargetVer = "7.0"; mtouch.NoStrip = true; DateTime dt = DateTime.MinValue; @@ -749,19 +749,19 @@ public class B : A {} mtouch.Abi = "armv7s,arm64"; mtouch.AssertExecuteFailure (MTouchAction.BuildDev, $"build: {mtouch.Abi}"); - mtouch.AssertErrorPattern (73, "Xamarin.iOS .* does not support a deployment target of 3.1 for iOS .the minimum is 6.0.. Please select a newer deployment target in your project's Info.plist."); + mtouch.AssertErrorPattern (73, "Xamarin.iOS .* does not support a deployment target of 3.1 for iOS .the minimum is 7.0.. Please select a newer deployment target in your project's Info.plist."); mtouch.Abi = "armv7s"; mtouch.AssertExecuteFailure (MTouchAction.BuildDev, $"build: {mtouch.Abi}"); - mtouch.AssertErrorPattern (73, "Xamarin.iOS .* does not support a deployment target of 3.1 for iOS .the minimum is 6.0.. Please select a newer deployment target in your project's Info.plist."); + mtouch.AssertErrorPattern (73, "Xamarin.iOS .* does not support a deployment target of 3.1 for iOS .the minimum is 7.0.. Please select a newer deployment target in your project's Info.plist."); mtouch.Abi = "arm64"; mtouch.AssertExecuteFailure (MTouchAction.BuildDev, $"build: {mtouch.Abi}"); - mtouch.AssertErrorPattern (73, "Xamarin.iOS .* does not support a deployment target of 3.1 for iOS .the minimum is 6.0.. Please select a newer deployment target in your project's Info.plist."); + mtouch.AssertErrorPattern (73, "Xamarin.iOS .* does not support a deployment target of 3.1 for iOS .the minimum is 7.0.. Please select a newer deployment target in your project's Info.plist."); mtouch.Abi = "armv7"; mtouch.AssertExecuteFailure (MTouchAction.BuildDev, $"build: {mtouch.Abi}"); - mtouch.AssertErrorPattern (73, "Xamarin.iOS .* does not support a deployment target of 3.1 for iOS .the minimum is 6.0.. Please select a newer deployment target in your project's Info.plist."); + mtouch.AssertErrorPattern (73, "Xamarin.iOS .* does not support a deployment target of 3.1 for iOS .the minimum is 7.0.. Please select a newer deployment target in your project's Info.plist."); } } @@ -1270,10 +1270,10 @@ public class B : A {} app.AppExtensions.Add (extension); app.CreateTemporaryApp (); app.CreateTemporaryCacheDirectory (); - app.TargetVer = "6.0"; + app.TargetVer = "7.0"; app.WarnAsError = new int [] { 112 }; app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); - app.AssertError (112, "Native code sharing has been disabled because the container app's deployment target is earlier than iOS 8.0 (it's 6.0)."); + app.AssertError (112, "Native code sharing has been disabled because the container app's deployment target is earlier than iOS 8.0 (it's 7.0)."); } } } diff --git a/tools/mtouch/BuildTasks.mtouch.cs b/tools/mtouch/BuildTasks.mtouch.cs index 9ba9f1908b..88da24b353 100644 --- a/tools/mtouch/BuildTasks.mtouch.cs +++ b/tools/mtouch/BuildTasks.mtouch.cs @@ -306,11 +306,12 @@ namespace Xamarin.Bundler // and very hard to diagnose otherwise when hidden from the build output. Ref: bug #2430 var linker_errors = new List (); var output = new StringBuilder (); - var code = await Driver.RunCommandAsync (Target.App.CompilerPath, CompilerFlags.ToString (), null, output); + var code = await Driver.RunCommandAsync (Target.App.CompilerPath, CompilerFlags.ToString (), null, output, suppressPrintOnErrors: true); Application.ProcessNativeLinkerOutput (Target, output.ToString (), CompilerFlags.AllLibraries, linker_errors, code != 0); if (code != 0) { + Console.WriteLine ($"Process exited with code {code}, command:\n{Target.App.CompilerPath} {CompilerFlags.ToString ()}\n{output} "); // if the build failed - it could be because of missing frameworks / libraries we identified earlier foreach (var assembly in Target.Assemblies) { if (assembly.UnresolvedModuleReferences == null)