xamarin-macios/tools/common/Frameworks.cs

564 строки
20 KiB
C#
Исходник Обычный вид История

2016-04-21 15:57:02 +03:00
using System;
using System.Collections.Generic;
#if MTOUCH || MMP
2016-04-21 15:57:02 +03:00
using Mono.Cecil;
using Xamarin.Bundler;
using Xamarin.Utils;
using Registrar;
#endif
2016-04-21 15:57:02 +03:00
public class Framework
{
public string Namespace;
public string Name;
public Version Version;
public Version VersionAvailableInSimulator;
public bool AlwaysWeakLinked;
2016-04-21 15:57:02 +03:00
}
public class Frameworks : Dictionary <string, Framework>
{
public void Add (string @namespace, int major_version)
{
Add (@namespace, @namespace, new Version (major_version, 0));
2016-04-21 15:57:02 +03:00
}
public void Add (string @namespace, string framework, int major_version)
{
Add (@namespace, framework, new Version (major_version, 0));
2016-04-21 15:57:02 +03:00
}
public void Add (string @namespace, int major_version, int minor_version)
{
Add (@namespace, @namespace, new Version (major_version, minor_version));
2016-04-21 15:57:02 +03:00
}
public void Add (string @namespace, string framework, int major_version, bool alwaysWeakLink)
{
Add (@namespace, framework, new Version (major_version, 0), null, alwaysWeakLink);
}
2016-04-21 15:57:02 +03:00
public void Add (string @namespace, string framework, int major_version, int minor_version)
2016-12-13 05:26:23 +03:00
{
Add (@namespace, framework, new Version (major_version, minor_version));
2016-12-13 05:26:23 +03:00
}
public void Add (string @namespace, string framework, int major_version, int minor_version, int build_version)
{
Add (@namespace, framework, new Version (major_version, minor_version, build_version));
}
2018-09-18 21:12:39 +03:00
public void Add (string @namespace, string framework, Version version, Version version_available_in_simulator = null, bool alwaysWeakLink = false)
2016-04-21 15:57:02 +03:00
{
var fr = new Framework () {
Namespace = @namespace,
2016-04-21 15:57:02 +03:00
Name = framework,
Version = version,
VersionAvailableInSimulator = version_available_in_simulator ?? version,
AlwaysWeakLinked = alwaysWeakLink,
2016-04-21 15:57:02 +03:00
};
base.Add (fr.Namespace, fr);
}
public Framework Find (string framework)
{
foreach (var kvp in this)
if (kvp.Value.Name == framework)
return kvp.Value;
return null;
}
static Version NotAvailableInSimulator = new Version (int.MaxValue, int.MaxValue);
2016-04-21 15:57:02 +03:00
static Frameworks mac_frameworks;
public static Frameworks MacFrameworks {
get {
if (mac_frameworks == null) {
mac_frameworks = new Frameworks () {
{ "Accelerate", 10, 0 },
{ "AppKit", 10, 0 },
{ "CoreGraphics", "QuartzCore", 10, 0 },
{ "CoreImage", "QuartzCore", 10, 0 },
{ "Foundation", 10, 0 },
{ "ImageKit", "Quartz", 10, 0 },
{ "PdfKit", "Quartz", 10, 0 },
{ "Security", 10, 0 },
{ "AudioUnit", 10, 2 },
{ "CoreMidi", "CoreMIDI", 10, 2 },
{ "WebKit", 10, 2},
{ "AudioToolbox", 10, 3 },
{ "CoreServices", 10, 3 },
{ "CoreVideo", 10, 3 },
{ "MobileCoreServices", "CoreServices", 10, 3 },
{ "OpenGL", 10, 3 },
{ "SearchKit", "CoreServices", 10,3 },
2016-04-21 15:57:02 +03:00
{ "SystemConfiguration", 10, 3 },
{ "CoreData", 10, 4 },
{ "ImageIO", 10, 4 },
{ "OpenAL", 10, 4 },
{ "CoreAnimation", "QuartzCore", 10, 5 },
{ "CoreText", 10, 5 },
{ "PrintCore", "CoreServices", 10,5 },
2016-04-21 15:57:02 +03:00
{ "ScriptingBridge", 10, 5 },
{ "QuickLook", 10, 5 },
{ "QuartzComposer", "Quartz", 10, 5 },
{ "ImageCaptureCore", "ImageCaptureCore", 10,5 },
2016-04-21 15:57:02 +03:00
{ "QTKit", 10, 6 },
{ "QuickLookUI", "Quartz", 10, 6 },
{ "MediaToolbox", 10, 9 },
{ "AVFoundation", 10, 7 },
{ "CoreBluetooth", "IOBluetooth", 10, 7 },
{ "CoreLocation", 10, 7 },
{ "CoreMedia", 10, 7 },
{ "CoreWlan", "CoreWLAN", 10, 7 },
{ "StoreKit", 10, 7 },
{ "Accounts", 10, 8 },
{ "AudioVideoBridging", 10, 8 },
{ "EventKit", 10, 8 },
{ "GameKit", 10, 8 },
{ "GLKit", 10, 8 },
{ "SceneKit", 10, 8 },
{ "Social", 10, 8 },
{ "VideoToolbox", 10, 8 },
{ "AVKit", 10, 9 },
{ "GameController", 10, 9 },
{ "MapKit", 10, 9 },
{ "MediaAccessibility", 10, 9 },
{ "MediaLibrary", 10, 9 },
{ "SpriteKit", 10, 9 },
{ "JavaScriptCore", "JavaScriptCore", 10, 9 },
{ "CloudKit", 10, 10 },
{ "CryptoTokenKit", 10, 10 },
{ "FinderSync", 10, 10 },
{ "Hypervisor", 10, 10 },
{ "LocalAuthentication", 10, 10 },
{ "MultipeerConnectivity", 10, 10 },
{ "NetworkExtension", 10, 10 },
2016-04-21 15:57:02 +03:00
{ "NotificationCenter", 10, 10 },
2016-04-21 15:57:02 +03:00
{ "Contacts", 10, 11 },
{ "ContactsUI", 10, 11 },
{ "CoreAudioKit", 10,11 },
{ "GameplayKit", 10, 11 },
2016-04-21 15:57:02 +03:00
{ "Metal", 10, 11 },
{ "MetalKit", 10, 11 },
{ "ModelIO", 10, 11 },
{ "Intents", 10, 12 },
{ "IOSurface", "IOSurface", 10, 12 },
{ "Photos", "Photos", 10,12 },
{ "PhotosUI", "PhotosUI", 10,12 },
{ "SafariServices", "SafariServices", 10, 12 },
2016-12-13 05:26:23 +03:00
{ "MediaPlayer", "MediaPlayer", 10, 12, 1 },
{ "CoreML", "CoreML", 10, 13 },
{ "CoreSpotlight", "CoreSpotlight", 10,13 },
{ "ExternalAccessory", "ExternalAccessory", 10, 13 },
[MetalPerformanceShaders] Xcode 9 bindings (#3005) * [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816) * [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938) The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10 * Remove some [Model] attributes that sholdn't be needed * Fix introspection test crashes * More introspection fixes * NN does not need to be PascalCased Remove unneeded Models and BaseTypes * PR Whitespace fixes and renamings * Paste fail * More fixes from PR comments * [MPS] Adds new intro test, fixes ctors and xtro output * Removes duplicated availability attributes. * Removes obsoleted API from macOS since mps is new to it. * Fixes xtro output. * Adds missing API. * Fixes parameterless ctors, some of them do not really work, found by our new intro test and disabled the one that seem to not make sense due to the presence of DesignatedInitializers. * Fixes a selector typo. * Adds new `ShouldNotExposeDefaultCtorTest` to intro. ShouldNotExposeDefaultCtorTest ============================== This test checks for types with a parameterless ctor that are subclasses of `NSObject` and then cheks if the BaseType of said objects also expose a parameterless ctor (all in .NET land), if this is not the case it reports them and so they can manually audited. Also this test has the ability to print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can take this code into an Xcode project and easily tests the ctors. It seems that xtro (sharpie) does not have a complete picture of when a ctor must be exposed hence the hability to generate this code and manually test. Right now this test is just enabled for MPS since it is the scope of this PR. In the future it should be enabled for all other frameworks and the output be manually audited. * [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback. https://bugzilla.xamarin.com/show_bug.cgi?id=59547 * Fixes premature collection possible in bindings im MPSKernel.cs * Fixes MPSImageHistogramTest from using deprecated API. * Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest. * [MPS] Reenable Copy API and DesignatedInitializer xtro feedback * Implement more feedback * More feedback
2017-11-28 23:29:05 +03:00
{ "MetalPerformanceShaders", "MetalPerformanceShaders", 10, 13 },
{ "Vision", "Vision", 10, 13 },
{ "BusinessChat", "BusinessChat", 10, 13, 4 },
2018-06-12 15:19:16 +03:00
{ "AdSupport", "AdSupport", 10,14 },
{ "NaturalLanguage", "NaturalLanguage", 10,14 },
{ "Network", "Network", 10, 14 },
{ "VideoSubscriberAccount", "VideoSubscriberAccount", 10,14 },
{ "UserNotifications", "UserNotifications", 10,14 },
{ "iTunesLibrary", "iTunesLibrary", 10,14 },
{ "AuthenticationServices", "AuthenticationServices", 10,15 },
{ "CoreMotion", "CoreMotion", 10,15 },
{ "DeviceCheck", "DeviceCheck", 10,15 },
{ "ExecutionPolicy", "ExecutionPolicy", 10,15 },
{ "FileProvider", "FileProvider", 10,15 },
{ "FileProviderUI", "FileProviderUI", 10,15 },
{ "PushKit", "PushKit", 10,15 },
{ "QuickLookThumbnailing", "QuickLookThumbnailing", 10,15 },
{ "SoundAnalysis", "SoundAnalysis", 10,15 },
{ "PencilKit", "PencilKit", 10,15 },
{ "Speech", "Speech", 10,15 },
{ "LinkPresentation", "LinkPresentation", 10,15 },
// not sure if the API is available, issue: https://github.com/xamarin/maccore/issues/1951
//{ "CoreHaptics", "CoreHaptics", 10,15 },
{ "AutomaticAssessmentConfiguration", "AutomaticAssessmentConfiguration", 10,15,4 },
{ "Accessibility", "Accessibility", 11,0 },
{ "CallKit", "CallKit", 11,0 },
{ "ClassKit", "ClassKit", 11,0 },
{ "MLCompute", "MLCompute", 11,0 },
{ "ReplayKit", "ReplayKit", 11,0 },
{ "UniformTypeIdentifiers", "UniformTypeIdentifiers", 11,0 },
{ "UserNotificationsUI", "UserNotificationsUI", 11,0 },
2016-04-21 15:57:02 +03:00
};
}
return mac_frameworks;
}
}
#if MTOUCH || __IOS__ || __TVOS__ || __WATCHOS__
2016-04-21 15:57:02 +03:00
static Frameworks ios_frameworks;
public static Frameworks GetiOSFrameworks (Application app)
{
if (ios_frameworks == null) {
ios_frameworks = new Frameworks () {
{ "AddressBook", "AddressBook", 3 },
{ "Security", "Security", 3 },
{ "AudioUnit", "AudioToolbox", 3 },
{ "AddressBookUI", "AddressBookUI", 3 },
{ "AudioToolbox", "AudioToolbox", 3 },
{ "AVFoundation", "AVFoundation", 3 },
{ "CoreAnimation", "QuartzCore", 3 },
{ "CoreData", "CoreData", 3 },
{ "CoreGraphics", "CoreGraphics", 3 },
{ "CoreLocation", "CoreLocation", 3 },
{ "ExternalAccessory", "ExternalAccessory", 3 },
{ "Foundation", "Foundation", 3 },
{ "GameKit", "GameKit", 3 },
{ "MapKit", "MapKit", 3 },
{ "MediaPlayer", "MediaPlayer", 3 },
{ "MessageUI", "MessageUI", 3 },
{ "MobileCoreServices", "MobileCoreServices", 3 },
{ "StoreKit", "StoreKit", 3 },
{ "SystemConfiguration", "SystemConfiguration", 3 },
{ "OpenGLES", "OpenGLES", 3 },
{ "UIKit", "UIKit", 3 },
{ "Accelerate", "Accelerate", 4 },
{ "EventKit", "EventKit", 4 },
{ "EventKitUI", "EventKitUI", 4 },
{ "CoreMotion", "CoreMotion", 4 },
{ "CoreMedia", "CoreMedia", 4 },
{ "CoreVideo", "CoreVideo", 4 },
{ "CoreTelephony", "CoreTelephony", 4 },
{ "iAd", "iAd", 4 },
{ "QuickLook", "QuickLook", 4 },
{ "ImageIO", "ImageIO", 4 },
{ "AssetsLibrary", "AssetsLibrary", 4 },
{ "CoreText", "CoreText", 4 },
{ "CoreMidi", "CoreMIDI", 4 },
{ "Accounts", "Accounts", 5 },
{ "GLKit", "GLKit", 5 },
{ "NewsstandKit", "NewsstandKit", 5 },
{ "CoreImage", "CoreImage", 5 },
{ "CoreBluetooth", "CoreBluetooth", 5 },
{ "Twitter", "Twitter", 5 },
{ "MediaToolbox", "MediaToolbox", 6 },
{ "PassKit", "PassKit", 6 },
{ "Social", "Social", 6 },
{ "AdSupport", "AdSupport", 6 },
{ "GameController", "GameController", 7 },
{ "JavaScriptCore", "JavaScriptCore", 7 },
{ "MediaAccessibility", "MediaAccessibility", 7 },
{ "MultipeerConnectivity", "MultipeerConnectivity", 7 },
{ "SafariServices", "SafariServices", 7 },
{ "SpriteKit", "SpriteKit", 7 },
{ "HealthKit", "HealthKit", 8 },
{ "HomeKit", "HomeKit", 8 },
{ "LocalAuthentication", "LocalAuthentication", 8 },
{ "NotificationCenter", "NotificationCenter", 8 },
{ "PushKit", "PushKit", 8 },
{ "Photos", "Photos", 8 },
{ "PhotosUI", "PhotosUI", 8 },
{ "SceneKit", "SceneKit", 8 },
{ "CloudKit", "CloudKit", 8 },
{ "AVKit", "AVKit", 8 },
{ "CoreAudioKit", "CoreAudioKit", app.IsSimulatorBuild ? 9 : 8 },
{ "Metal", "Metal", new Version (8, 0), new Version (9, 0) },
{ "WebKit", "WebKit", 8 },
{ "NetworkExtension", "NetworkExtension", 8 },
{ "VideoToolbox", "VideoToolbox", 8 },
// { "WatchKit", "WatchKit", 8,2 }, // Removed in Xcode 11
{ "ReplayKit", "ReplayKit", 9 },
{ "Contacts", "Contacts", 9 },
{ "ContactsUI", "ContactsUI", 9 },
{ "CoreSpotlight", "CoreSpotlight", 9 },
{ "WatchConnectivity", "WatchConnectivity", 9 },
{ "ModelIO", "ModelIO", 9 },
{ "MetalKit", "MetalKit", 9 },
Specify when iOS got headers for MetalPerformanceShaders. (#4524) Fixes this problem in the MT4134 test: Process exited with code 1, command: /Applications/Xcode83.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Wno-receiver-forward-class -Wno-objc-missing-super-calls -gdwarf-2 -I/Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/usr/include -isysroot /Applications/Xcode83.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -Qunused-arguments -fobjc-legacy-dispatch -fobjc-abi-version=2 -mios-simulator-version-min=11.4 -arch x86_64 -c -o /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/mtouch/bin/Debug/tmp-test-dir/Xamarin.Tests.BundlerTool.CreateTemporaryDirectory513/mtouch-test-cache/x86_64/registrar.o -x objective-c++ /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/mtouch/bin/Debug/tmp-test-dir/Xamarin.Tests.BundlerTool.CreateTemporaryDirectory513/mtouch-test-cache/registrar.m In file included from /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/mtouch/bin/Debug/tmp-test-dir/Xamarin.Tests.BundlerTool.CreateTemporaryDirectory513/mtouch-test-cache/registrar.m:2: /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/mtouch/bin/Debug/tmp-test-dir/Xamarin.Tests.BundlerTool.CreateTemporaryDirectory513/mtouch-test-cache/registrar.h:47:9: fatal error: 'MetalPerformanceShaders/MetalPerformanceShaders.h' file not found #import <MetalPerformanceShaders/MetalPerformanceShaders.h> Note that the error is because the test is building with Xcode 8.3 (and this is also why the problem wasn't found by the PR bots: they don't have older Xcodes installed to run this particular test).
2018-07-30 17:11:11 +03:00
{ "MetalPerformanceShaders", "MetalPerformanceShaders", new Version (9, 0), new Version (11, 0) /* MPS got simulator headers in Xcode 9 */ },
{ "GameplayKit", "GameplayKit", 9 },
{ "HealthKitUI", "HealthKitUI", 9,3 },
{ "CallKit", "CallKit", 10 },
{ "Messages", "Messages", 10 },
{ "Speech", "Speech", 10 },
{ "VideoSubscriberAccount", "VideoSubscriberAccount", 10 },
{ "UserNotifications", "UserNotifications", 10 },
{ "UserNotificationsUI", "UserNotificationsUI", 10 },
{ "Intents", "Intents", 10 },
{ "IntentsUI", "IntentsUI", 10 },
{ "ARKit", "ARKit", 11 },
{ "CoreNFC", "CoreNFC", 11, true }, /* not always present, e.g. iPad w/iOS 12, so must be weak linked */
{ "DeviceCheck", "DeviceCheck", new Version (11, 0), new Version (13, 0) },
{ "IdentityLookup", "IdentityLookup", 11 },
{ "IOSurface", "IOSurface", new Version (11, 0), NotAvailableInSimulator /* Not available in the simulator (the header is there, but broken) */ },
{ "CoreML", "CoreML", 11 },
{ "Vision", "Vision", 11 },
{ "FileProvider", "FileProvider", 11 },
{ "FileProviderUI", "FileProviderUI", 11 },
{ "PdfKit", "PDFKit", 11 },
{ "BusinessChat", "BusinessChat", 11, 3 },
{ "ClassKit", "ClassKit", 11,4 },
{ "AuthenticationServices", "AuthenticationServices", 12,0 },
{ "CarPlay", "CarPlay", 12,0 },
{ "IdentityLookupUI", "IdentityLookupUI", 12,0 },
{ "NaturalLanguage", "NaturalLanguage", 12,0 },
{ "Network", "Network", 12, 0 },
{ "BackgroundTasks", "BackgroundTasks", 13, 0 },
{ "CoreHaptics", "CoreHaptics", 13, 0 },
{ "LinkPresentation", "LinkPresentation", 13, 0 },
{ "MetricKit", "MetricKit", 13, 0 },
{ "PencilKit", "PencilKit", 13, 0 },
{ "QuickLookThumbnailing", "QuickLookThumbnailing", 13,0 },
{ "SoundAnalysis", "SoundAnalysis", 13, 0 },
{ "VisionKit", "VisionKit", 13, 0 },
{ "AutomaticAssessmentConfiguration", "AutomaticAssessmentConfiguration", 13, 4 },
{ "Accessibility", "Accessibility", 14,0 },
{ "AppClip", "AppClip", 14,0 },
{ "MediaSetup", "MediaSetup", new Version (14, 0), NotAvailableInSimulator /* no headers in beta 3 */ },
{ "MLCompute", "MLCompute", new Version (14,0), NotAvailableInSimulator },
{ "SensorKit", "SensorKit", 14,0 },
{ "UniformTypeIdentifiers", "UniformTypeIdentifiers", 14,0 },
// the above MUST be kept in sync with simlauncher
// see tools/mtouch/Makefile
// please also keep it sorted to ease comparison
//
// The following tests also need to be updated:
//
// * RegistrarTest.MT4134
};
2016-04-21 15:57:02 +03:00
}
return ios_frameworks;
2016-04-21 15:57:02 +03:00
}
static Frameworks watch_frameworks;
public static Frameworks GetwatchOSFrameworks (Application app)
{
if (watch_frameworks == null) {
watch_frameworks = new Frameworks {
{ "Accelerate", "Accelerate", 2 },
// The CFNetwork framework is in the SDK, but there are no headers inside the framework, so don't enable yet.
// { "CFNetwork", "CFNetwork", 2 },
{ "ClockKit", "ClockKit", 2 },
{ "Contacts", "Contacts", 2 },
{ "CoreData", "CoreData", 2 },
{ "CoreFoundation", "CoreFoundation", 2 },
{ "CoreGraphics", "CoreGraphics", 2 },
{ "CoreLocation", "CoreLocation", 2 },
{ "CoreMotion", "CoreMotion", 2 },
{ "EventKit", "EventKit", 2 },
{ "Foundation", "Foundation", 2 },
{ "HealthKit", "HealthKit", 2 },
{ "HomeKit", "HomeKit", 2 },
{ "ImageIO", "ImageIO", 2 },
{ "MapKit", "MapKit", 2 },
{ "MobileCoreServices", "MobileCoreServices", 2 },
{ "PassKit", "PassKit", 2 },
{ "Security", "Security", 2 },
{ "UIKit", "UIKit", 2 },
{ "WatchConnectivity", "WatchConnectivity", 2 },
{ "WatchKit", "WatchKit", 2 },
{ "CoreText", "CoreText", 2,2 },
// AVFoundation was introduced in 3.0, but the simulator SDK was broken until 3.2.
{ "AVFoundation", "AVFoundation", 3, app.IsSimulatorBuild ? 2 : 0 },
{ "CloudKit", "CloudKit", 3 },
{ "GameKit", "GameKit", new Version (3, 0), new Version (3, 2) /* No headers provided for watchOS/simulator until watchOS 3.2. */ },
{ "SceneKit", "SceneKit", 3 },
{ "SpriteKit", "SpriteKit", 3 },
{ "UserNotifications", "UserNotifications", 3 },
{ "Intents", "Intents", 3,2 },
{ "CoreBluetooth", "CoreBluetooth", 4 },
{ "CoreML", "CoreML", 4 },
{ "CoreVideo", "CoreVideo", 4 },
{ "NaturalLanguage", "NaturalLanguage", 5 },
{ "MediaPlayer", "MediaPlayer", 5 },
{ "AuthenticationServices", "AuthenticationServices", 6 },
{ "Network", "Network", 6 },
{ "PushKit", "PushKit", 6 },
{ "SoundAnalysis", "SoundAnalysis", 6 },
{ "CoreMedia", "CoreMedia", 6 },
{ "StoreKit", "StoreKit", 6,2 },
{ "Accessibility", "Accessibility", 7,0 },
{ "UniformTypeIdentifiers", "UniformTypeIdentifiers", 7,0 },
};
2016-04-21 15:57:02 +03:00
}
return watch_frameworks;
2016-04-21 15:57:02 +03:00
}
static Frameworks tvos_frameworks;
public static Frameworks TVOSFrameworks {
get {
if (tvos_frameworks == null) {
tvos_frameworks = new Frameworks () {
{ "AVFoundation", "AVFoundation", 9 },
{ "AVKit", "AVKit", 9 },
{ "Accelerate", "Accelerate", 9 },
{ "AdSupport", "AdSupport", 9 },
{ "AudioToolbox", "AudioToolbox", 9 },
{ "AudioUnit", "AudioToolbox", 9 },
{ "CFNetwork", "CFNetwork", 9 },
{ "CloudKit", "CloudKit", 9 },
{ "CoreAnimation", "QuartzCore", 9 },
{ "CoreAudio", "CoreAudio", 9 },
{ "CoreBluetooth", "CoreBluetooth", 9 },
{ "CoreData", "CoreData", 9 },
{ "CoreGraphics", "CoreGraphics", 9 },
{ "CoreImage", "CoreImage", 9 },
{ "CoreLocation", "CoreLocation", 9 },
{ "CoreMedia", "CoreMedia", 9 },
{ "CoreText", "CoreText", 9 },
{ "CoreVideo", "CoreVideo", 9 },
{ "Foundation", "Foundation", 9 },
{ "GLKit", "GLKit", 9 },
{ "GameController", "GameController", 9 },
{ "GameKit", "GameKit", 9 },
{ "GameplayKit", "GameplayKit", 9 },
{ "ImageIO", "ImageIO", 9 },
{ "JavaScriptCore", "JavaScriptCore", 9 },
{ "MediaAccessibility", "MediaAccessibility", 9 },
{ "MediaPlayer", "MediaPlayer", 9 },
{ "MediaToolbox", "MediaToolbox", 9 },
2016-04-21 15:57:02 +03:00
{ "Metal", "Metal", 9 },
{ "MetalKit", "MetalKit", new Version (9, 0), new Version (10, 0) },
{ "MetalPerformanceShaders", "MetalPerformanceShaders", new Version (9, 0), NotAvailableInSimulator /* not available in the simulator */ },
{ "CoreServices", "CFNetwork", 9 },
2016-04-21 15:57:02 +03:00
{ "MobileCoreServices", "MobileCoreServices", 9 },
{ "ModelIO", "ModelIO", 9 },
{ "OpenGLES", "OpenGLES", 9 },
{ "SceneKit", "SceneKit", 9 },
{ "Security", "Security", 9 },
{ "SpriteKit", "SpriteKit", 9 },
{ "StoreKit", "StoreKit", 9 },
{ "SystemConfiguration", "SystemConfiguration", 9 },
{ "TVMLKit", "TVMLKit", 9 },
{ "TVServices", "TVServices", 9 },
{ "UIKit", "UIKit", 9 },
{ "MapKit", "MapKit", 9, 2 },
{ "ExternalAccessory", "ExternalAccessory", 10 },
{ "HomeKit", "HomeKit", 10 },
{ "MultipeerConnectivity", 10 },
{ "Photos", "Photos", 10 },
{ "PhotosUI", "PhotosUI", 10 },
{ "ReplayKit", "ReplayKit", 10 },
{ "UserNotifications", "UserNotifications", 10 },
{ "VideoSubscriberAccount", "VideoSubscriberAccount", 10 },
{ "VideoToolbox", "VideoToolbox", 10,2 },
{ "DeviceCheck", "DeviceCheck", new Version (11, 0), new Version (13, 0) },
{ "CoreML", "CoreML", 11 },
{ "IOSurface", "IOSurface", new Version (11, 0), NotAvailableInSimulator /* Not available in the simulator (the header is there, but broken) */ },
{ "Vision", "Vision", 11 },
{ "NaturalLanguage", "NaturalLanguage", 12,0 },
{ "Network", "Network", 12, 0 } ,
{ "TVUIKit", "TVUIKit", 12,0 },
{ "AuthenticationServices", "AuthenticationServices", 13,0 },
{ "SoundAnalysis", "SoundAnalysis", 13,0 },
{ "BackgroundTasks", "BackgroundTasks", 13, 0 },
{ "Accessibility", "Accessibility", 14,0 },
{ "LinkPresentation", "LinkPresentation", 14,0 },
{ "MLCompute", "MLCompute", new Version (14,0), NotAvailableInSimulator },
{ "UniformTypeIdentifiers", "UniformTypeIdentifiers", 14,0 },
2016-04-21 15:57:02 +03:00
};
}
return tvos_frameworks;
}
}
#endif
2016-04-21 15:57:02 +03:00
#if MMP
public static void Gather (Application app, AssemblyDefinition product_assembly, HashSet<string> frameworks, HashSet<string> weak_frameworks)
2016-04-21 15:57:02 +03:00
{
var namespaces = new HashSet<string> ();
// Collect all the namespaces.
foreach (ModuleDefinition md in product_assembly.Modules)
foreach (TypeDefinition td in md.Types)
namespaces.Add (td.Namespace);
// Iterate over all the namespaces and check which frameworks we need to link with.
foreach (var nspace in namespaces) {
switch (nspace) {
case "QTKit":
if (Driver.LinkProhibitedFrameworks) {
2020-01-31 23:02:52 +03:00
ErrorHelper.Warning (5221, Errors.MM5221, nspace);
} else {
2020-01-31 23:02:52 +03:00
ErrorHelper.Warning (5220, Errors.MM5220, nspace);
continue;
}
break;
}
if (Driver.GetFrameworks (app).TryGetValue (nspace, out var framework)) {
if (app.SdkVersion >= framework.Version) {
var add_to = app.DeploymentTarget >= framework.Version ? frameworks : weak_frameworks;
2016-04-21 15:57:02 +03:00
add_to.Add (framework.Name);
continue;
}
}
}
}
#endif
#if MMP || MTOUCH
// This checks if a framework is unavailable due to bugs in Xcode (such as Apple forgetting to ship a library or headers for a framework, which seems to happen at least once a year).
public static bool IsFrameworkBroken (Application app, string framework)
{
if (app.IsSimulatorBuild && Driver.XcodeProductVersion == "12A8169g" /* Xcode 12 beta 3 */) {
switch (framework) {
// Apple seems to have forgotten to ship the several libraries for the simulator in Xcode 12 betas (it's still available for device builds).
// https://github.com/xamarin/maccore/issues/2266
case "MediaSetup":
if (app.Platform != ApplePlatform.iOS)
return false;
break;
// framework missing on both iOS and tvOS simulators (but present for macOS)
case "MLCompute":
if (app.Platform == ApplePlatform.MacOSX)
return false;
break;
default:
return false;
}
Driver.Log (1, $"Can't use '{framework}' in the simulator because Apple didn't ship it with Xcode 12 beta {Driver.XcodeProductVersion}");
return true;
}
return false;
}
#endif
}