public void GatherFrameworks() { Assembly asm = null; foreach (var assembly in Assemblies) { if (assembly.AssemblyDefinition.Name.Name == Driver.GetProductAssembly(App)) { asm = assembly; break; } } if (asm == null) { throw ErrorHelper.CreateError(99, Errors.MX0099, $"could not find the product assembly {Driver.GetProductAssembly(App)} in the list of assemblies referenced by the executable"); } AssemblyDefinition productAssembly = asm.AssemblyDefinition; // *** make sure any change in the above lists (or new list) are also reflected in // *** Makefile so simlauncher-sgen does not miss any framework HashSet <string> processed = new HashSet <string> (); #if !MONOMAC Version v80 = new Version(8, 0); #endif foreach (ModuleDefinition md in productAssembly.Modules) { foreach (TypeDefinition td in md.Types) { // process only once each namespace (as we keep adding logic below) string nspace = td.Namespace; if (processed.Contains(nspace)) { continue; } processed.Add(nspace); Framework framework; if (Driver.GetFrameworks(App).TryGetValue(nspace, out framework)) { // framework specific processing switch (framework.Name) { #if MONOMAC && !NET case "QTKit": // we already warn in Frameworks.cs Gather method if (!Driver.LinkProhibitedFrameworks) { continue; } break; #else case "CoreAudioKit": // CoreAudioKit seems to be functional in the iOS 9 simulator. if (App.IsSimulatorBuild && App.SdkVersion.Major < 9) { continue; } break; case "Metal": case "MetalKit": case "MetalPerformanceShaders": #if !NET case "CHIP": #endif case "PHASE": case "ThreadNetwork": // some frameworks do not exists on simulators and will result in linker errors if we include them if (App.IsSimulatorBuild) { continue; } break; case "DeviceCheck": if (App.IsSimulatorBuild && App.SdkVersion.Major < 13) { continue; } break; case "PushKit": // in Xcode 6 beta 7 this became an (ld) error - it was a warning earlier :( // ld: embedded dylibs/frameworks are only supported on iOS 8.0 and later (@rpath/PushKit.framework/PushKit) for architecture armv7 // this was fixed in Xcode 6.2 (6.1 was still buggy) see #29786 if ((App.DeploymentTarget < v80) && (Driver.XcodeVersion < new Version(6, 2))) { ErrorHelper.Warning(49, Errors.MT0049, framework.Name); continue; } break; #if !NET case "WatchKit": // Xcode 11 doesn't ship WatchKit for iOS if (Driver.XcodeVersion.Major == 11 && App.Platform == ApplePlatform.iOS) { ErrorHelper.Warning(5219, Errors.MT5219); continue; } break; #endif default: if (App.IsSimulatorBuild && !App.IsFrameworkAvailableInSimulator(framework.Name)) { if (App.AreAnyAssembliesTrimmed) { ErrorHelper.Warning(5223, Errors.MX5223, framework.Name, App.PlatformName); } else { Driver.Log(3, Errors.MX5223, framework.Name, App.PlatformName); } continue; } break; #endif } if (framework.Unavailable) { ErrorHelper.Warning(181, Errors.MX0181 /* Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). */, framework.Name, td.FullName, App.PlatformName); continue; } if (App.SdkVersion >= framework.Version) { var add_to = framework.AlwaysWeakLinked || App.DeploymentTarget < framework.Version ? asm.WeakFrameworks : asm.Frameworks; add_to.Add(framework.Name); continue; } else { Driver.Log(3, "Not linking with the framework {0} (used by the type {1}) because it was introduced in {2} {3}, and we're using the {2} {4} SDK.", framework.Name, td.FullName, App.PlatformName, framework.Version, App.SdkVersion); } } } } // Make sure there are no duplicates between frameworks and weak frameworks. // Keep the weak ones. asm.Frameworks.ExceptWith(asm.WeakFrameworks); }