[tools] Unify information about CoreNFC in the Frameworks class, and fix selecting whether a framework should be linked weakly or not in dotnet-linker.

This fixes a startup crash in the simulator with Xcode 12:

    Library not loaded: /usr/lib/libnfshared.dylib
      Referenced from: /Applications/Xcode_12.0.0-GMb.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreNFC.framework/CoreNFC
      Reason: no suitable image found.  Did find:
    	/usr/lib/libnfshared.dylib: mach-o, but not built for platform iOS-sim

Ref: https://stackoverflow.com/q/63915728/183422
This commit is contained in:
Rolf Bjarne Kvinge 2020-09-25 09:26:07 +02:00
Родитель 022f5d331c
Коммит 2e52dfdb3b
2 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -330,7 +330,7 @@ public class Frameworks : Dictionary <string, Framework>
{ "IntentsUI", "IntentsUI", 10 },
{ "ARKit", "ARKit", 11 },
{ "CoreNFC", "CoreNFC", 11, true }, /* not always present, e.g. iPad w/iOS 12, so must be weak linked */
{ "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) */
{ "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) */ },
@ -575,9 +575,14 @@ public class Frameworks : Dictionary <string, Framework>
if (app.IsSimulatorBuild && !framework.IsFrameworkAvailableInSimulator (app))
continue;
var add_to = app.DeploymentTarget >= framework.Version ? frameworks : weak_frameworks;
var weak_link = framework.AlwaysWeakLinked || app.DeploymentTarget < framework.Version;
var add_to = weak_link ? weak_frameworks : frameworks;
add_to.Add (framework.Name);
}
// Make sure there are no duplicates between frameworks and weak frameworks.
// Keep the weak ones.
frameworks.ExceptWith (weak_frameworks);
}
static bool FilterFrameworks (Application app, Framework framework)

Просмотреть файл

@ -223,7 +223,6 @@ namespace Xamarin.Bundler {
case "Metal":
case "MetalKit":
case "MetalPerformanceShaders":
case "CoreNFC":
// some frameworks do not exists on simulators and will result in linker errors if we include them
if (App.IsSimulatorBuild)
continue;