2016-04-21 15:57:02 +03:00
using System ;
using System.Collections.Generic ;
2020-06-29 16:56:55 +03:00
#if MTOUCH | | MMP | | BUNDLER
2016-04-21 15:57:02 +03:00
using Mono.Cecil ;
using Xamarin.Bundler ;
2018-02-05 18:26:29 +03:00
using Registrar ;
2018-06-08 20:00:48 +03:00
#endif
2016-04-21 15:57:02 +03:00
2020-05-05 17:52:56 +03:00
using Xamarin.Utils ;
2016-04-21 15:57:02 +03:00
public class Framework
{
public string Namespace ;
public string Name ;
public Version Version ;
2018-07-27 17:30:08 +03:00
public Version VersionAvailableInSimulator ;
2018-08-20 15:34:29 +03:00
public bool AlwaysWeakLinked ;
2020-11-17 11:30:08 +03:00
public bool Unavailable ;
2020-07-01 16:21:45 +03:00
#if MTOUCH | | MMP | | BUNDLER
public bool IsFrameworkAvailableInSimulator ( Application app )
{
if ( VersionAvailableInSimulator = = null )
return false ;
if ( VersionAvailableInSimulator > app . SdkVersion )
return false ;
return true ;
}
#endif
2016-04-21 15:57:02 +03:00
}
public class Frameworks : Dictionary < string , Framework >
{
public void Add ( string @namespace , int major_version )
{
2017-02-21 22:02:39 +03:00
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 )
{
2017-02-21 22:02:39 +03:00
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 )
{
2017-02-21 22:02:39 +03:00
Add ( @namespace , @namespace , new Version ( major_version , minor_version ) ) ;
2016-04-21 15:57:02 +03:00
}
2018-08-20 15:34:29 +03:00
public void Add ( string @namespace , string framework , int major_version , bool alwaysWeakLink )
{
2018-09-19 19:27:43 +03:00
Add ( @namespace , framework , new Version ( major_version , 0 ) , null , alwaysWeakLink ) ;
2018-08-20 15:34:29 +03:00
}
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
{
2017-02-21 22:02:39 +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 )
2017-02-21 22:02:39 +03:00
{
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 ( ) {
2018-06-08 20:00:48 +03:00
Namespace = @namespace ,
2016-04-21 15:57:02 +03:00
Name = framework ,
2018-07-27 17:30:08 +03:00
Version = version ,
VersionAvailableInSimulator = version_available_in_simulator ? ? version ,
2018-08-20 15:34:29 +03:00
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 ;
}
2018-07-27 17:30:08 +03:00
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 } ,
2020-08-11 11:37:35 +03:00
{ "CoreFoundation" , "CoreFoundation" , 10 , 0 } ,
2016-04-21 15:57:02 +03:00
{ "CoreGraphics" , "QuartzCore" , 10 , 0 } ,
{ "CoreImage" , "QuartzCore" , 10 , 0 } ,
{ "Foundation" , 10 , 0 } ,
{ "ImageKit" , "Quartz" , 10 , 0 } ,
{ "PdfKit" , "Quartz" , 10 , 0 } ,
{ "Security" , 10 , 0 } ,
2020-08-11 11:37:35 +03:00
{ "GSS" , "GSS" , 10 , 1 } ,
2016-04-21 15:57:02 +03:00
{ "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 } ,
2018-06-08 20:00:48 +03:00
{ "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 } ,
2018-06-08 20:00:48 +03:00
{ "PrintCore" , "CoreServices" , 10 , 5 } ,
2016-04-21 15:57:02 +03:00
{ "ScriptingBridge" , 10 , 5 } ,
{ "QuickLook" , 10 , 5 } ,
{ "QuartzComposer" , "Quartz" , 10 , 5 } ,
2018-11-07 17:52:39 +03:00
{ "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 } ,
2020-06-02 17:17:51 +03:00
{ "CFNetwork" , 10 , 8 } ,
2016-04-21 15:57:02 +03:00
{ "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 } ,
2018-06-08 20:00:48 +03:00
{ "NetworkExtension" , 10 , 10 } ,
2016-04-21 15:57:02 +03:00
{ "NotificationCenter" , 10 , 10 } ,
2018-06-08 20:00:48 +03:00
2016-04-21 15:57:02 +03:00
{ "Contacts" , 10 , 11 } ,
2018-06-08 20:00:48 +03:00
{ "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 } ,
2016-07-13 00:21:35 +03:00
{ "Intents" , 10 , 12 } ,
2017-09-05 15:57:58 +03:00
{ "IOSurface" , "IOSurface" , 10 , 12 } ,
2018-06-08 20:00:48 +03:00
{ "Photos" , "Photos" , 10 , 12 } ,
{ "PhotosUI" , "PhotosUI" , 10 , 12 } ,
2016-08-30 02:22:34 +03:00
{ "SafariServices" , "SafariServices" , 10 , 12 } ,
2016-12-13 05:26:23 +03:00
{ "MediaPlayer" , "MediaPlayer" , 10 , 12 , 1 } ,
2017-07-01 01:35:30 +03:00
{ "CoreML" , "CoreML" , 10 , 13 } ,
2018-06-08 20:00:48 +03:00
{ "CoreSpotlight" , "CoreSpotlight" , 10 , 13 } ,
{ "ExternalAccessory" , "ExternalAccessory" , 10 , 13 } ,
2017-11-28 23:29:05 +03:00
{ "MetalPerformanceShaders" , "MetalPerformanceShaders" , 10 , 13 } ,
2018-06-08 20:00:48 +03:00
{ "Vision" , "Vision" , 10 , 13 } ,
2018-04-05 23:12:28 +03:00
{ "BusinessChat" , "BusinessChat" , 10 , 13 , 4 } ,
2018-06-12 15:19:16 +03:00
{ "AdSupport" , "AdSupport" , 10 , 14 } ,
2018-06-14 20:21:44 +03:00
{ "NaturalLanguage" , "NaturalLanguage" , 10 , 14 } ,
2018-07-05 22:01:47 +03:00
{ "Network" , "Network" , 10 , 14 } ,
2018-06-15 23:43:23 +03:00
{ "VideoSubscriberAccount" , "VideoSubscriberAccount" , 10 , 14 } ,
2018-06-19 08:39:55 +03:00
{ "UserNotifications" , "UserNotifications" , 10 , 14 } ,
2018-08-08 17:34:16 +03:00
{ "iTunesLibrary" , "iTunesLibrary" , 10 , 14 } ,
2019-06-14 03:09:34 +03:00
2019-06-26 15:27:29 +03:00
{ "AuthenticationServices" , "AuthenticationServices" , 10 , 15 } ,
2019-06-27 04:44:33 +03:00
{ "CoreMotion" , "CoreMotion" , 10 , 15 } ,
2019-06-14 03:09:34 +03:00
{ "DeviceCheck" , "DeviceCheck" , 10 , 15 } ,
2019-08-15 05:07:55 +03:00
{ "ExecutionPolicy" , "ExecutionPolicy" , 10 , 15 } ,
2019-08-14 15:12:07 +03:00
{ "FileProvider" , "FileProvider" , 10 , 15 } ,
{ "FileProviderUI" , "FileProviderUI" , 10 , 15 } ,
2019-06-27 15:19:42 +03:00
{ "PushKit" , "PushKit" , 10 , 15 } ,
2019-08-19 16:01:52 +03:00
{ "QuickLookThumbnailing" , "QuickLookThumbnailing" , 10 , 15 } ,
2019-06-21 17:05:27 +03:00
{ "SoundAnalysis" , "SoundAnalysis" , 10 , 15 } ,
2019-06-27 16:18:58 +03:00
{ "PencilKit" , "PencilKit" , 10 , 15 } ,
2019-07-02 02:42:49 +03:00
{ "Speech" , "Speech" , 10 , 15 } ,
2019-07-08 23:24:53 +03:00
{ "LinkPresentation" , "LinkPresentation" , 10 , 15 } ,
2019-09-12 01:49:29 +03:00
// not sure if the API is available, issue: https://github.com/xamarin/maccore/issues/1951
//{ "CoreHaptics", "CoreHaptics", 10,15 },
2020-03-06 03:48:28 +03:00
{ "AutomaticAssessmentConfiguration" , "AutomaticAssessmentConfiguration" , 10 , 15 , 4 } ,
2020-06-27 04:54:25 +03:00
2020-07-25 05:03:46 +03:00
{ "Accessibility" , "Accessibility" , 11 , 0 } ,
2020-08-19 16:54:04 +03:00
{ "AppTrackingTransparency" , "AppTrackingTransparency" , 11 , 0 } ,
2020-07-25 05:03:46 +03:00
{ "CallKit" , "CallKit" , 11 , 0 } ,
{ "ClassKit" , "ClassKit" , 11 , 0 } ,
{ "MLCompute" , "MLCompute" , 11 , 0 } ,
2020-10-08 23:33:03 +03:00
{ "OSLog" , "OSLog" , 11 , 0 } ,
2020-08-18 03:01:41 +03:00
{ "PassKit" , "PassKit" , 11 , 0 } ,
2020-07-25 05:03:46 +03:00
{ "ReplayKit" , "ReplayKit" , 11 , 0 } ,
2020-08-15 18:04:23 +03:00
{ "ScreenTime" , "ScreenTime" , 11 , 0 } ,
2020-07-25 05:03:46 +03:00
{ "UniformTypeIdentifiers" , "UniformTypeIdentifiers" , 11 , 0 } ,
{ "UserNotificationsUI" , "UserNotificationsUI" , 11 , 0 } ,
2016-04-21 15:57:02 +03:00
} ;
}
return mac_frameworks ;
}
}
static Frameworks ios_frameworks ;
2020-05-05 17:52:56 +03:00
public static Frameworks GetiOSFrameworks ( bool is_simulator_build )
2016-12-23 20:50:35 +03:00
{
2020-11-17 11:30:08 +03:00
if ( ios_frameworks = = null )
ios_frameworks = CreateiOSFrameworks ( is_simulator_build ) ;
return ios_frameworks ;
}
public static Frameworks CreateiOSFrameworks ( bool is_simulator_build )
{
return new Frameworks ( ) {
2016-12-23 20:50:35 +03:00
{ "AddressBook" , "AddressBook" , 3 } ,
{ "Security" , "Security" , 3 } ,
{ "AudioUnit" , "AudioToolbox" , 3 } ,
{ "AddressBookUI" , "AddressBookUI" , 3 } ,
{ "AudioToolbox" , "AudioToolbox" , 3 } ,
{ "AVFoundation" , "AVFoundation" , 3 } ,
2020-06-02 17:17:51 +03:00
{ "CFNetwork" , "CFNetwork" , 3 } ,
2016-12-23 20:50:35 +03:00
{ "CoreAnimation" , "QuartzCore" , 3 } ,
{ "CoreData" , "CoreData" , 3 } ,
2020-08-11 11:37:35 +03:00
{ "CoreFoundation" , "CoreFoundation" , 3 } ,
2016-12-23 20:50:35 +03:00
{ "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 } ,
2020-08-11 11:37:35 +03:00
{ "GSS" , "GSS" , 5 } ,
2016-12-23 20:50:35 +03:00
{ "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 } ,
2020-05-05 17:52:56 +03:00
{ "CoreAudioKit" , "CoreAudioKit" , is_simulator_build ? 9 : 8 } ,
2018-07-27 17:30:08 +03:00
{ "Metal" , "Metal" , new Version ( 8 , 0 ) , new Version ( 9 , 0 ) } ,
2016-12-23 20:50:35 +03:00
{ "WebKit" , "WebKit" , 8 } ,
{ "NetworkExtension" , "NetworkExtension" , 8 } ,
{ "VideoToolbox" , "VideoToolbox" , 8 } ,
2019-08-14 18:46:55 +03:00
// { "WatchKit", "WatchKit", 8,2 }, // Removed in Xcode 11
2016-12-23 20:50:35 +03:00
{ "ReplayKit" , "ReplayKit" , 9 } ,
{ "Contacts" , "Contacts" , 9 } ,
{ "ContactsUI" , "ContactsUI" , 9 } ,
{ "CoreSpotlight" , "CoreSpotlight" , 9 } ,
{ "WatchConnectivity" , "WatchConnectivity" , 9 } ,
{ "ModelIO" , "ModelIO" , 9 } ,
{ "MetalKit" , "MetalKit" , 9 } ,
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 */ } ,
2016-12-23 20:50:35 +03:00
{ "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 } ,
2017-06-19 21:56:00 +03:00
2017-06-23 03:02:17 +03:00
{ "ARKit" , "ARKit" , 11 } ,
2020-09-25 10:26:07 +03:00
{ "CoreNFC" , "CoreNFC" , new Version ( 11 , 0 ) , NotAvailableInSimulator , true } , /* not always present, e.g. iPad w/iOS 12, so must be weak linked; doesn't work in the simulator in Xcode 12 (https://stackoverflow.com/q/63915728/183422) */
2019-06-14 03:09:34 +03:00
{ "DeviceCheck" , "DeviceCheck" , new Version ( 11 , 0 ) , new Version ( 13 , 0 ) } ,
2017-06-29 21:13:52 +03:00
{ "IdentityLookup" , "IdentityLookup" , 11 } ,
2018-07-27 17:30:08 +03:00
{ "IOSurface" , "IOSurface" , new Version ( 11 , 0 ) , NotAvailableInSimulator /* Not available in the simulator (the header is there, but broken) */ } ,
2017-07-01 01:35:30 +03:00
{ "CoreML" , "CoreML" , 11 } ,
2017-07-18 19:12:10 +03:00
{ "Vision" , "Vision" , 11 } ,
2017-07-20 18:16:46 +03:00
{ "FileProvider" , "FileProvider" , 11 } ,
2017-07-24 18:12:30 +03:00
{ "FileProviderUI" , "FileProviderUI" , 11 } ,
2017-08-04 16:06:21 +03:00
{ "PdfKit" , "PDFKit" , 11 } ,
2018-04-05 23:12:28 +03:00
{ "BusinessChat" , "BusinessChat" , 11 , 3 } ,
2018-04-05 23:12:28 +03:00
2018-04-05 18:20:05 +03:00
{ "ClassKit" , "ClassKit" , 11 , 4 } ,
2018-06-12 22:12:20 +03:00
2018-06-13 21:06:37 +03:00
{ "AuthenticationServices" , "AuthenticationServices" , 12 , 0 } ,
2018-06-12 22:12:20 +03:00
{ "CarPlay" , "CarPlay" , 12 , 0 } ,
2018-06-16 04:46:35 +03:00
{ "IdentityLookupUI" , "IdentityLookupUI" , 12 , 0 } ,
2018-06-14 20:21:44 +03:00
{ "NaturalLanguage" , "NaturalLanguage" , 12 , 0 } ,
2018-07-05 22:01:47 +03:00
{ "Network" , "Network" , 12 , 0 } ,
2019-06-21 17:05:27 +03:00
2019-07-02 16:54:21 +03:00
{ "BackgroundTasks" , "BackgroundTasks" , 13 , 0 } ,
2019-09-10 20:03:26 +03:00
{ "CoreHaptics" , "CoreHaptics" , 13 , 0 } ,
2019-09-10 05:58:39 +03:00
{ "LinkPresentation" , "LinkPresentation" , 13 , 0 } ,
2019-09-11 22:46:38 +03:00
{ "MetricKit" , "MetricKit" , 13 , 0 } ,
2019-06-27 16:18:58 +03:00
{ "PencilKit" , "PencilKit" , 13 , 0 } ,
2019-08-19 16:01:52 +03:00
{ "QuickLookThumbnailing" , "QuickLookThumbnailing" , 13 , 0 } ,
2019-09-10 05:58:39 +03:00
{ "SoundAnalysis" , "SoundAnalysis" , 13 , 0 } ,
2019-08-25 03:48:16 +03:00
{ "VisionKit" , "VisionKit" , 13 , 0 } ,
2019-09-10 05:58:39 +03:00
2020-03-06 03:48:28 +03:00
{ "AutomaticAssessmentConfiguration" , "AutomaticAssessmentConfiguration" , 13 , 4 } ,
2020-07-25 05:03:46 +03:00
{ "Accessibility" , "Accessibility" , 14 , 0 } ,
2020-06-27 00:13:30 +03:00
{ "AppClip" , "AppClip" , 14 , 0 } ,
2020-08-19 16:54:04 +03:00
{ "AppTrackingTransparency" , "AppTrackingTransparency" , 14 , 0 } ,
2020-07-25 05:03:46 +03:00
{ "MediaSetup" , "MediaSetup" , new Version ( 14 , 0 ) , NotAvailableInSimulator /* no headers in beta 3 */ } ,
{ "MLCompute" , "MLCompute" , new Version ( 14 , 0 ) , NotAvailableInSimulator } ,
2020-08-10 23:06:02 +03:00
{ "NearbyInteraction" , "NearbyInteraction" , 14 , 0 } ,
2020-08-15 18:04:23 +03:00
{ "ScreenTime" , "ScreenTime" , 14 , 0 } ,
2020-07-21 20:12:51 +03:00
{ "SensorKit" , "SensorKit" , 14 , 0 } ,
2020-07-09 15:50:57 +03:00
{ "UniformTypeIdentifiers" , "UniformTypeIdentifiers" , 14 , 0 } ,
2020-06-27 00:13:30 +03:00
2019-09-10 05:58:39 +03:00
// the above MUST be kept in sync with simlauncher
// see tools/mtouch/Makefile
// please also keep it sorted to ease comparison
2020-02-20 00:13:34 +03:00
//
// The following tests also need to be updated:
//
// * RegistrarTest.MT4134
2016-12-23 20:50:35 +03:00
} ;
2016-04-21 15:57:02 +03:00
}
static Frameworks watch_frameworks ;
2020-05-05 17:52:56 +03:00
public static Frameworks GetwatchOSFrameworks ( bool is_simulator_build )
2017-05-31 14:10:51 +03:00
{
if ( watch_frameworks = = null ) {
watch_frameworks = new Frameworks {
2018-06-08 20:00:48 +03:00
{ "Accelerate" , "Accelerate" , 2 } ,
2017-05-31 14:10:51 +03:00
// 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 } ,
2018-06-08 20:00:48 +03:00
{ "CoreText" , "CoreText" , 2 , 2 } ,
2017-05-31 14:10:51 +03:00
// AVFoundation was introduced in 3.0, but the simulator SDK was broken until 3.2.
2020-05-05 17:52:56 +03:00
{ "AVFoundation" , "AVFoundation" , 3 , is_simulator_build ? 2 : 0 } ,
2017-05-31 14:10:51 +03:00
{ "CloudKit" , "CloudKit" , 3 } ,
2018-07-27 17:30:08 +03:00
{ "GameKit" , "GameKit" , new Version ( 3 , 0 ) , new Version ( 3 , 2 ) /* No headers provided for watchOS/simulator until watchOS 3.2. */ } ,
2017-05-31 14:10:51 +03:00
{ "SceneKit" , "SceneKit" , 3 } ,
{ "SpriteKit" , "SpriteKit" , 3 } ,
{ "UserNotifications" , "UserNotifications" , 3 } ,
{ "Intents" , "Intents" , 3 , 2 } ,
2017-07-01 01:35:30 +03:00
2018-06-08 20:00:48 +03:00
{ "CoreBluetooth" , "CoreBluetooth" , 4 } ,
2017-07-01 01:35:30 +03:00
{ "CoreML" , "CoreML" , 4 } ,
2018-06-08 20:00:48 +03:00
{ "CoreVideo" , "CoreVideo" , 4 } ,
2018-07-04 21:43:00 +03:00
{ "NaturalLanguage" , "NaturalLanguage" , 5 } ,
2018-07-10 19:38:19 +03:00
{ "MediaPlayer" , "MediaPlayer" , 5 } ,
2019-06-21 17:05:27 +03:00
2019-06-26 15:27:29 +03:00
{ "AuthenticationServices" , "AuthenticationServices" , 6 } ,
2019-08-29 04:22:10 +03:00
{ "Network" , "Network" , 6 } ,
2019-06-27 15:19:42 +03:00
{ "PushKit" , "PushKit" , 6 } ,
2019-06-21 17:05:27 +03:00
{ "SoundAnalysis" , "SoundAnalysis" , 6 } ,
2019-07-11 21:14:58 +03:00
{ "CoreMedia" , "CoreMedia" , 6 } ,
2020-07-09 15:50:57 +03:00
{ "StoreKit" , "StoreKit" , 6 , 2 } ,
2019-06-21 17:05:27 +03:00
2020-07-15 23:29:15 +03:00
{ "Accessibility" , "Accessibility" , 7 , 0 } ,
2020-07-25 05:03:46 +03:00
{ "UniformTypeIdentifiers" , "UniformTypeIdentifiers" , 7 , 0 } ,
2017-05-31 14:10:51 +03:00
} ;
2016-04-21 15:57:02 +03:00
}
2017-05-31 14:10:51 +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 } ,
2020-08-11 11:37:35 +03:00
{ "CoreFoundation" , "CoreFoundation" , 9 } ,
2016-04-21 15:57:02 +03:00
{ "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 } ,
2018-06-08 20:00:48 +03:00
{ "MediaToolbox" , "MediaToolbox" , 9 } ,
2016-04-21 15:57:02 +03:00
{ "Metal" , "Metal" , 9 } ,
2019-05-06 17:05:49 +03:00
{ "MetalKit" , "MetalKit" , new Version ( 9 , 0 ) , new Version ( 10 , 0 ) } ,
2018-07-27 17:30:08 +03:00
{ "MetalPerformanceShaders" , "MetalPerformanceShaders" , new Version ( 9 , 0 ) , NotAvailableInSimulator /* not available in the simulator */ } ,
2018-06-08 20:00:48 +03:00
{ "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 } ,
2016-06-15 23:51:21 +03:00
2016-07-10 18:15:45 +03:00
{ "MapKit" , "MapKit" , 9 , 2 } ,
2016-07-24 17:44:19 +03:00
{ "ExternalAccessory" , "ExternalAccessory" , 10 } ,
2016-08-30 02:22:34 +03:00
{ "HomeKit" , "HomeKit" , 10 } ,
2016-07-10 18:15:45 +03:00
{ "MultipeerConnectivity" , 10 } ,
2016-08-09 22:39:15 +03:00
{ "Photos" , "Photos" , 10 } ,
{ "PhotosUI" , "PhotosUI" , 10 } ,
2016-07-10 18:15:45 +03:00
{ "ReplayKit" , "ReplayKit" , 10 } ,
2016-06-22 10:35:50 +03:00
{ "UserNotifications" , "UserNotifications" , 10 } ,
2016-07-10 18:15:45 +03:00
{ "VideoSubscriberAccount" , "VideoSubscriberAccount" , 10 } ,
2017-02-21 22:02:39 +03:00
{ "VideoToolbox" , "VideoToolbox" , 10 , 2 } ,
2017-06-29 04:29:08 +03:00
2019-06-14 03:09:34 +03:00
{ "DeviceCheck" , "DeviceCheck" , new Version ( 11 , 0 ) , new Version ( 13 , 0 ) } ,
2017-07-01 01:35:30 +03:00
{ "CoreML" , "CoreML" , 11 } ,
2018-07-27 17:30:08 +03:00
{ "IOSurface" , "IOSurface" , new Version ( 11 , 0 ) , NotAvailableInSimulator /* Not available in the simulator (the header is there, but broken) */ } ,
2017-07-18 19:12:10 +03:00
{ "Vision" , "Vision" , 11 } ,
2018-06-14 20:21:44 +03:00
{ "NaturalLanguage" , "NaturalLanguage" , 12 , 0 } ,
2018-07-31 23:30:23 +03:00
{ "Network" , "Network" , 12 , 0 } ,
2018-06-28 15:51:38 +03:00
{ "TVUIKit" , "TVUIKit" , 12 , 0 } ,
2019-06-21 17:05:27 +03:00
2019-06-26 15:27:29 +03:00
{ "AuthenticationServices" , "AuthenticationServices" , 13 , 0 } ,
2019-06-21 17:05:27 +03:00
{ "SoundAnalysis" , "SoundAnalysis" , 13 , 0 } ,
2019-07-02 16:54:21 +03:00
{ "BackgroundTasks" , "BackgroundTasks" , 13 , 0 } ,
2020-06-27 03:00:54 +03:00
2020-07-25 05:03:46 +03:00
{ "Accessibility" , "Accessibility" , 14 , 0 } ,
2020-08-19 16:54:04 +03:00
{ "AppTrackingTransparency" , "AppTrackingTransparency" , 14 , 0 } ,
2020-08-05 18:43:44 +03:00
{ "CoreHaptics" , "CoreHaptics" , 14 , 0 } ,
2020-06-27 03:00:54 +03:00
{ "LinkPresentation" , "LinkPresentation" , 14 , 0 } ,
2020-07-25 05:03:46 +03:00
{ "MLCompute" , "MLCompute" , new Version ( 14 , 0 ) , NotAvailableInSimulator } ,
2020-07-09 15:50:57 +03:00
{ "UniformTypeIdentifiers" , "UniformTypeIdentifiers" , 14 , 0 } ,
2020-07-30 16:36:59 +03:00
{ "Intents" , "Intents" , 14 , 0 } ,
2016-04-21 15:57:02 +03:00
} ;
}
return tvos_frameworks ;
}
}
2020-05-05 17:52:56 +03:00
2020-11-17 11:30:08 +03:00
static Frameworks catalyst_frameworks ;
public static Frameworks GetMacCatalystFrameworks ( )
{
if ( catalyst_frameworks = = null ) {
catalyst_frameworks = CreateiOSFrameworks ( false ) ;
// These frameworks are not available on Mac Catalyst
catalyst_frameworks [ "OpenGLES" ] . Unavailable = true ;
catalyst_frameworks [ "NewsstandKit" ] . Unavailable = true ;
catalyst_frameworks [ "MediaSetup" ] . Unavailable = true ;
catalyst_frameworks [ "NotificationCenter" ] . Unavailable = true ;
catalyst_frameworks [ "GLKit" ] . Unavailable = true ;
catalyst_frameworks [ "VideoSubscriberAccount" ] . Unavailable = true ;
// The headers for FileProviderUI exist, but the native linker fails
catalyst_frameworks [ "FileProviderUI" ] . Unavailable = true ;
// The headers for Twitter are there, , but no documentation whatsoever online and the native linker fails too
catalyst_frameworks [ "Twitter" ] . Unavailable = true ;
// These frameworks were added to Catalyst after they were added to iOS, so we have to adjust the Versions fields
var fourteenTwoFrameworks = new [ ] {
"AddressBook" ,
"AddressBookUI" ,
"ARKit" ,
"AssetsLibrary" ,
"CarPlay" ,
"ClassKit" ,
"HomeKit" ,
"Messages" ,
"UserNotificationsUI" ,
} ;
foreach ( var fw in fourteenTwoFrameworks ) {
var f = catalyst_frameworks [ fw ] ;
f . Version = new Version ( 14 , 2 ) ;
f . VersionAvailableInSimulator = new Version ( 14 , 2 ) ;
}
}
return catalyst_frameworks ;
}
2020-05-05 17:52:56 +03:00
// returns null if the platform doesn't exist (the ErrorHandler machinery is heavy and this file is included in several projects, which makes throwing an exception complicated)
public static Frameworks GetFrameworks ( ApplePlatform platform , bool is_simulator_build )
{
switch ( platform ) {
case ApplePlatform . iOS :
return GetiOSFrameworks ( is_simulator_build ) ;
case ApplePlatform . WatchOS :
return GetwatchOSFrameworks ( is_simulator_build ) ;
case ApplePlatform . TVOS :
return TVOSFrameworks ;
case ApplePlatform . MacOSX :
return MacFrameworks ;
2020-11-17 11:30:08 +03:00
case ApplePlatform . MacCatalyst :
return GetMacCatalystFrameworks ( ) ;
2020-05-05 17:52:56 +03:00
default :
return null ;
}
}
2016-04-21 15:57:02 +03:00
2020-06-29 16:56:55 +03:00
#if MTOUCH | | MMP | | BUNDLER
static void Gather ( Application app , AssemblyDefinition product_assembly , HashSet < string > frameworks , HashSet < string > weak_frameworks , Func < Framework , bool > include_framework )
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.
2020-06-29 16:56:55 +03:00
var all_frameworks = GetFrameworks ( app . Platform , app . IsSimulatorBuild ) ;
2016-04-21 15:57:02 +03:00
foreach ( var nspace in namespaces ) {
2020-06-29 16:56:55 +03:00
if ( ! all_frameworks . TryGetValue ( nspace , out var framework ) )
continue ;
if ( ! include_framework ( framework ) )
continue ;
if ( app . SdkVersion < framework . Version ) {
// We're building with an old sdk, and the framework doesn't exist there.
continue ;
}
2020-07-01 16:21:45 +03:00
if ( app . IsSimulatorBuild & & ! framework . IsFrameworkAvailableInSimulator ( app ) )
continue ;
2020-09-25 10:26:07 +03:00
var weak_link = framework . AlwaysWeakLinked | | app . DeploymentTarget < framework . Version ;
var add_to = weak_link ? weak_frameworks : frameworks ;
2020-06-29 16:56:55 +03:00
add_to . Add ( framework . Name ) ;
}
2020-09-25 10:26:07 +03:00
// Make sure there are no duplicates between frameworks and weak frameworks.
// Keep the weak ones.
frameworks . ExceptWith ( weak_frameworks ) ;
2020-06-29 16:56:55 +03:00
}
static bool FilterFrameworks ( Application app , Framework framework )
{
switch ( app . Platform ) {
case ApplePlatform . iOS :
case ApplePlatform . TVOS :
case ApplePlatform . WatchOS :
break ; // Include all frameworks by default
case ApplePlatform . MacOSX :
switch ( framework . Name ) {
2019-05-23 23:59:40 +03:00
case "QTKit" :
2020-06-29 16:56:55 +03:00
#if MMP
2019-05-23 23:59:40 +03:00
if ( Driver . LinkProhibitedFrameworks ) {
2020-06-29 16:56:55 +03:00
ErrorHelper . Warning ( 5221 , Errors . MM5221 , framework . Name ) ;
} else {
ErrorHelper . Warning ( 5220 , Errors . MM5220 , framework . Name ) ;
return false ;
2016-04-21 15:57:02 +03:00
}
2020-06-29 16:56:55 +03:00
#endif
return true ;
2016-04-21 15:57:02 +03:00
}
2020-06-29 16:56:55 +03:00
return true ;
default :
throw ErrorHelper . CreateError ( 71 , Errors . MX0071 /* "Unknown platform: {0}. This usually indicates a bug in {1}; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case." */ , app . Platform , app . GetProductName ( ) ) ;
2016-04-21 15:57:02 +03:00
}
2020-06-29 16:56:55 +03:00
return true ;
2016-04-21 15:57:02 +03:00
}
2020-06-29 16:56:55 +03:00
public static void Gather ( Application app , AssemblyDefinition product_assembly , HashSet < string > frameworks , HashSet < string > weak_frameworks )
{
Gather ( app , product_assembly , frameworks , weak_frameworks , ( framework ) = > FilterFrameworks ( app , framework ) ) ;
}
#endif // MTOUCH || MMP || BUNDLER
2016-06-15 22:32:48 +03:00
}