Merge branch 'master' into mono-2018-06
This commit is contained in:
Коммит
fdf3536170
|
@ -156,6 +156,8 @@ Alternatively, enable the managed [linker](https://docs.microsoft.com/xamarin/ma
|
|||
|
||||
As a last-straw solution, use an older version of Xamarin.Mac that does not require these new SDKs to be present during the build process.
|
||||
|
||||
<!-- 0136 and 0137 used by mtouch -->
|
||||
|
||||
# MM1xxx: file copy / symlinks (project related)
|
||||
|
||||
### <a name="MM1034">MM1034: Could not create symlink '{file}' -> '{target}': error {number}
|
||||
|
|
|
@ -683,6 +683,22 @@ Alternatively, enable the managed [linker](https://docs.microsoft.com/en-us/xama
|
|||
|
||||
As a last-straw solution, use an older version of Xamarin.iOS that does not require these new SDKs to be present during the build process.
|
||||
|
||||
### <a name="MT0136"/>MT0136: Cannot find the assembly {assembly} referenced from {assembly}.
|
||||
|
||||
This warning occurs when an assembly passed to mtouch contains a reference to
|
||||
another assembly that can't be found.
|
||||
|
||||
mtouch may in certain cases still find references at a later point, which
|
||||
means that if the build otherwise succeeds, this warning can be ignored.
|
||||
|
||||
### <a name="MT0137"/>MT0137: Cannot find the assembly {assembly}, referenced by an attribute in {assembly}.
|
||||
|
||||
This warning occurs when an attribute contains a reference to another assembly
|
||||
that can't be found.
|
||||
|
||||
mtouch may in certain cases still find references at a later point, which
|
||||
means that if the build otherwise succeeds, this warning can be ignored.
|
||||
|
||||
# MT1xxx: Project related error messages
|
||||
|
||||
### MT10xx: Installer / mtouch
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 0e0e4a68f947748fdcde3d83d28c99b613f23ba3
|
||||
Subproject commit dc815ae5623e963e6fce54dec8a2601bcf501084
|
|
@ -29,7 +29,7 @@ namespace Xamarin.MacDev.Tasks
|
|||
|
||||
public string Type { get; set; }
|
||||
|
||||
public string Value;
|
||||
public string Value { get; set; }
|
||||
|
||||
static string GetType (PObject value)
|
||||
{
|
||||
|
|
|
@ -55,5 +55,11 @@ namespace Foundation {
|
|||
{
|
||||
get {return error.UserInfo; }
|
||||
}
|
||||
|
||||
public override string Message {
|
||||
get {
|
||||
return error.Description;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace Xamarin.Tests
|
|||
abstract class BundlerTool : Tool
|
||||
{
|
||||
public const string None = "None";
|
||||
public bool AlwaysShowOutput;
|
||||
|
||||
#pragma warning disable 0649 // Field 'X' is never assigned to, and will always have its default value Y
|
||||
// These map directly to mtouch/mmp options
|
||||
|
@ -306,7 +307,7 @@ namespace Xamarin.Tests
|
|||
|
||||
public virtual int Execute ()
|
||||
{
|
||||
return Execute (ToolArguments, always_show_output: Verbosity > 0);
|
||||
return Execute (ToolArguments, always_show_output: Verbosity > 0 || AlwaysShowOutput);
|
||||
}
|
||||
|
||||
public virtual void AssertExecute (string message = null)
|
||||
|
|
|
@ -2690,4 +2690,43 @@ namespace MonoTouchFixtures.ObjCRuntime {
|
|||
public class SomeConsumer : NSObject, ISomeDelegate
|
||||
{
|
||||
}
|
||||
#if !__WATCHOS__ // no MetalKit on watchOS
|
||||
// These classes implement Metal* protocols, so that the generated registrar code includes the corresponding Metal* headers.
|
||||
// https://github.com/xamarin/xamarin-macios/issues/4422
|
||||
class MetalKitTypesInTheSimulator : NSObject, MetalKit.IMTKViewDelegate {
|
||||
public void Draw (MetalKit.MTKView view)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public void DrawableSizeWillChange (MetalKit.MTKView view, CGSize size)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
class MetalTypesInTheSimulator : NSObject, global::Metal.IMTLDrawable {
|
||||
public void Present ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public void Present (double presentationTime)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
#if !__TVOS__ // MetalPerformanceShaders isn't available in the tvOS simulator either
|
||||
class MetalPerformanceShadersTypesInTheSimulator : NSObject, global::MetalPerformanceShaders.IMPSDeviceProvider {
|
||||
public global::Metal.IMTLDevice GetMTLDevice ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public void Present (double presentationTime)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
#endif // !__TVOS__
|
||||
#endif // !__WATCHOS__
|
||||
}
|
||||
|
|
|
@ -59,6 +59,18 @@ namespace MonoTouchFixtures.SafariServices {
|
|||
Assert.False (rl.Add (local, null, null, out error), "Add-3");
|
||||
Assert.That (error.Domain, Is.EqualTo ((string) SSReadingList.ErrorDomain), "Domain");
|
||||
Assert.That (error.Code, Is.EqualTo ((nint) (int) SSReadingListError.UrlSchemeNotAllowed), "Code");
|
||||
|
||||
try {
|
||||
throw new NSErrorException (error);
|
||||
}
|
||||
catch (NSErrorException ns) {
|
||||
Assert.That (ns.Error.Code, Is.EqualTo (error.Code), "Code");
|
||||
Assert.That (ns.Error.Domain, Is.EqualTo (error.Domain), "Domain");
|
||||
Assert.That (ns.Message, Is.EqualTo (error.Description), "Message");
|
||||
}
|
||||
catch (Exception e) {
|
||||
Assert.Fail (e.ToString ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1716,6 +1716,67 @@ public class TestApp {
|
|||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MT0136 ()
|
||||
{
|
||||
using (var mtouch = new MTouchTool ()) {
|
||||
var tmpdir = mtouch.CreateTemporaryDirectory ();
|
||||
mtouch.CreateTemporaryCacheDirectory ();
|
||||
|
||||
var codeDll = @"public class A {}";
|
||||
var codeExe = @"public class B : A {}";
|
||||
|
||||
var dllPath = CompileTestAppLibrary (tmpdir, codeDll, profile: Profile.iOS, appName: "A");
|
||||
|
||||
mtouch.CreateTemporaryApp (extraCode: codeExe, extraArg: $"-r:{StringUtils.Quote (dllPath)}");
|
||||
mtouch.Debug = false;
|
||||
mtouch.Linker = MTouchLinker.DontLink;
|
||||
File.Delete (dllPath);
|
||||
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
|
||||
mtouch.AssertWarningPattern (136, "Cannot find the assembly 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' referenced from '.*/testApp.exe'.");
|
||||
mtouch.AssertError (2002, "Failed to resolve assembly: 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'");
|
||||
mtouch.AssertErrorCount (1);
|
||||
mtouch.AssertWarningCount (1);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MT0137 ()
|
||||
{
|
||||
using (var mtouch = new MTouchTool ()) {
|
||||
var tmpdir = mtouch.CreateTemporaryDirectory ();
|
||||
mtouch.CreateTemporaryCacheDirectory ();
|
||||
|
||||
var codeDll = @"public class A {}";
|
||||
var codeExe = @"
|
||||
[assembly: MyCustomAttribute (typeof (A))]
|
||||
|
||||
public class MyCustomAttribute : System.Attribute
|
||||
{
|
||||
public MyCustomAttribute (System.Type type) {}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerTypeProxyAttribute (typeof (A))]
|
||||
public class B
|
||||
{
|
||||
}
|
||||
";
|
||||
var codeExeFile = Path.Combine (tmpdir, "extraCode.cs");
|
||||
File.WriteAllText (codeExeFile, codeExe);
|
||||
var dllPath = CompileTestAppLibrary (tmpdir, codeDll, profile: Profile.iOS, appName: "A");
|
||||
|
||||
mtouch.CreateTemporaryApp (extraArg: $"-r:{StringUtils.Quote (dllPath)} {StringUtils.Quote (codeExeFile)}");
|
||||
mtouch.Debug = false;
|
||||
mtouch.Linker = MTouchLinker.DontLink;
|
||||
File.Delete (dllPath);
|
||||
mtouch.AlwaysShowOutput = true;
|
||||
mtouch.AssertExecute (MTouchAction.BuildSim, "build");
|
||||
mtouch.AssertWarning (137, "Cannot find the assembly 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null', referenced by a MyCustomAttribute attribute in 'testApp.exe'.");
|
||||
mtouch.AssertWarning (137, "Cannot find the assembly 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null', referenced by a System.Diagnostics.DebuggerTypeProxyAttribute attribute in 'testApp.exe'.");
|
||||
mtouch.AssertWarningCount (2);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase ("all")]
|
||||
[TestCase ("-all")]
|
||||
|
|
|
@ -278,7 +278,7 @@ class MyObjectErr : NSObject, IFoo1, IFoo2
|
|||
mtouch.CreateTemporaryApp (extraCode: sb.ToString (), usings: "using System; using Foundation; using ObjCRuntime;", extraArg: "/debug:full");
|
||||
mtouch.Linker = MTouchLinker.LinkSdk;
|
||||
mtouch.Registrar = MTouchRegistrar.Static;
|
||||
mtouch.AssertExecuteFailure ();
|
||||
mtouch.AssertExecuteFailure (MTouchAction.BuildDev);
|
||||
var invalidFrameworks = new [] {
|
||||
new { Framework = "IdentityLookup", Version = "11.0" },
|
||||
new { Framework = "FileProviderUI", Version = "11.0" },
|
||||
|
@ -296,6 +296,8 @@ class MyObjectErr : NSObject, IFoo1, IFoo2
|
|||
mtouch.AssertError (4134, $"Your application is using the '{framework.Framework}' framework, which isn't included in the iOS SDK you're using to build your app (this framework was introduced in iOS {framework.Version}, while you're building with the iOS {mtouch.Sdk} SDK.) Please select a newer SDK in your app's iOS Build options.");
|
||||
mtouch.AssertErrorCount (invalidFrameworks.Length);
|
||||
mtouch.AssertWarningCount (0);
|
||||
|
||||
mtouch.AssertExecute (MTouchAction.BuildSim);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -368,6 +368,13 @@ namespace Xamarin.Bundler {
|
|||
|
||||
string file = Path.GetFileNameWithoutExtension (name);
|
||||
|
||||
#if !MONOMAC
|
||||
if (App.IsSimulatorBuild && !Driver.IsFrameworkAvailableInSimulator (App, file)) {
|
||||
Driver.Log (3, "Not linking with {0} (referenced by a module reference in {1}) because it's not available in the simulator.", file, FileName);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (file) {
|
||||
// special case
|
||||
case "__Internal":
|
||||
|
@ -402,21 +409,6 @@ namespace Xamarin.Bundler {
|
|||
if (Frameworks.Add ("Accelerate"))
|
||||
Driver.Log (3, "Linking with the framework Accelerate because {0} is referenced by a module reference in {1}", file, FileName);
|
||||
break;
|
||||
case "CoreAudioKit":
|
||||
case "Metal":
|
||||
case "MetalKit":
|
||||
case "MetalPerformanceShaders":
|
||||
case "CoreNFC":
|
||||
case "DeviceCheck":
|
||||
// some frameworks do not exists on simulators and will result in linker errors if we include them
|
||||
#if MTOUCH
|
||||
if (!App.IsSimulatorBuild) {
|
||||
#endif
|
||||
AddFramework (file);
|
||||
#if MTOUCH
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case "openal32":
|
||||
if (Frameworks.Add ("OpenAL"))
|
||||
Driver.Log (3, "Linking with the framework OpenAL because {0} is referenced by a module reference in {1}", file, FileName);
|
||||
|
|
|
@ -13,6 +13,7 @@ public class Framework
|
|||
public string Namespace;
|
||||
public string Name;
|
||||
public Version Version;
|
||||
public Version VersionAvailableInSimulator;
|
||||
}
|
||||
|
||||
public class Frameworks : Dictionary <string, Framework>
|
||||
|
@ -42,7 +43,7 @@ public class Frameworks : Dictionary <string, Framework>
|
|||
Add (@namespace, framework, new Version (major_version, minor_version, build_version));
|
||||
}
|
||||
|
||||
public void Add (string @namespace, string framework, Version version)
|
||||
public void Add (string @namespace, string framework, Version version, Version version_available_in_simulator = null)
|
||||
{
|
||||
var fr = new Framework () {
|
||||
#if MTOUCH || MMP
|
||||
|
@ -51,7 +52,8 @@ public class Frameworks : Dictionary <string, Framework>
|
|||
Namespace = @namespace,
|
||||
#endif
|
||||
Name = framework,
|
||||
Version = version
|
||||
Version = version,
|
||||
VersionAvailableInSimulator = version_available_in_simulator ?? version,
|
||||
};
|
||||
base.Add (fr.Namespace, fr);
|
||||
}
|
||||
|
@ -64,6 +66,8 @@ public class Frameworks : Dictionary <string, Framework>
|
|||
return null;
|
||||
}
|
||||
|
||||
static Version NotAvailableInSimulator = new Version (int.MaxValue, int.MaxValue);
|
||||
|
||||
static Frameworks mac_frameworks;
|
||||
public static Frameworks MacFrameworks {
|
||||
get {
|
||||
|
@ -239,7 +243,7 @@ public class Frameworks : Dictionary <string, Framework>
|
|||
{ "CloudKit", "CloudKit", 8 },
|
||||
{ "AVKit", "AVKit", 8 },
|
||||
{ "CoreAudioKit", "CoreAudioKit", app.IsSimulatorBuild ? 9 : 8 },
|
||||
{ "Metal", "Metal", 8 },
|
||||
{ "Metal", "Metal", new Version (8, 0), new Version (9, 0) },
|
||||
{ "WebKit", "WebKit", 8 },
|
||||
{ "NetworkExtension", "NetworkExtension", 8 },
|
||||
{ "VideoToolbox", "VideoToolbox", 8 },
|
||||
|
@ -252,7 +256,7 @@ public class Frameworks : Dictionary <string, Framework>
|
|||
{ "WatchConnectivity", "WatchConnectivity", 9 },
|
||||
{ "ModelIO", "ModelIO", 9 },
|
||||
{ "MetalKit", "MetalKit", 9 },
|
||||
{ "MetalPerformanceShaders", "MetalPerformanceShaders", 9 },
|
||||
{ "MetalPerformanceShaders", "MetalPerformanceShaders", new Version (9, 0), new Version (11, 0) /* MPS got simulator headers in Xcode 9 */ },
|
||||
{ "GameplayKit", "GameplayKit", 9 },
|
||||
{ "HealthKitUI", "HealthKitUI", 9,3 },
|
||||
|
||||
|
@ -267,9 +271,9 @@ public class Frameworks : Dictionary <string, Framework>
|
|||
|
||||
{ "ARKit", "ARKit", 11 },
|
||||
{ "CoreNFC", "CoreNFC", 11 },
|
||||
{ "DeviceCheck", "DeviceCheck", 11 },
|
||||
{ "DeviceCheck", "DeviceCheck", new Version (11, 0), NotAvailableInSimulator /* no headers provided for simulator */ },
|
||||
{ "IdentityLookup", "IdentityLookup", 11 },
|
||||
{ "IOSurface", "IOSurface", 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 },
|
||||
|
@ -317,7 +321,7 @@ public class Frameworks : Dictionary <string, Framework>
|
|||
// 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", 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 },
|
||||
|
@ -366,7 +370,7 @@ public class Frameworks : Dictionary <string, Framework>
|
|||
{ "MediaToolbox", "MediaToolbox", 9 },
|
||||
{ "Metal", "Metal", 9 },
|
||||
{ "MetalKit", "MetalKit", 9 },
|
||||
{ "MetalPerformanceShaders", "MetalPerformanceShaders", 9 },
|
||||
{ "MetalPerformanceShaders", "MetalPerformanceShaders", new Version (9, 0), NotAvailableInSimulator /* not available in the simulator */ },
|
||||
{ "CoreServices", "CFNetwork", 9 },
|
||||
{ "MobileCoreServices", "MobileCoreServices", 9 },
|
||||
{ "ModelIO", "ModelIO", 9 },
|
||||
|
@ -392,9 +396,9 @@ public class Frameworks : Dictionary <string, Framework>
|
|||
{ "VideoSubscriberAccount", "VideoSubscriberAccount", 10 },
|
||||
{ "VideoToolbox", "VideoToolbox", 10,2 },
|
||||
|
||||
{ "DeviceCheck", "DeviceCheck", 11 },
|
||||
{ "DeviceCheck", "DeviceCheck", new Version (11, 0), NotAvailableInSimulator /* no headers provided for simulator */ },
|
||||
{ "CoreML", "CoreML", 11 },
|
||||
{ "IOSurface", "IOSurface", 11 },
|
||||
{ "IOSurface", "IOSurface", new Version (11, 0), NotAvailableInSimulator /* Not available in the simulator (the header is there, but broken) */ },
|
||||
{ "Vision", "Vision", 11 },
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2053,6 +2053,13 @@ namespace Registrar {
|
|||
|
||||
namespaces.Add (ns);
|
||||
|
||||
#if !MMP
|
||||
if (App.IsSimulatorBuild && !Driver.IsFrameworkAvailableInSimulator (App, ns)) {
|
||||
Driver.Log (5, "Not importing the framework {0} in the generated registrar code because it's not available in the simulator.", ns);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
string h;
|
||||
switch (ns) {
|
||||
#if MMP
|
||||
|
@ -2121,30 +2128,6 @@ namespace Registrar {
|
|||
}
|
||||
goto default;
|
||||
#endif
|
||||
case "CoreAudioKit":
|
||||
// fatal error: 'CoreAudioKit/CoreAudioKit.h' file not found
|
||||
// radar filed with Apple - but that framework / header is not yet shipped with the iOS SDK simulator
|
||||
#if MTOUCH
|
||||
if (IsSimulator)
|
||||
return;
|
||||
#endif
|
||||
goto default;
|
||||
case "Metal":
|
||||
case "MetalKit":
|
||||
case "MetalPerformanceShaders": // https://trello.com/c/mrjkAO9U/518-metal-simulator
|
||||
// #error Metal Simulator is currently unsupported
|
||||
// this framework is _officially_ not available on the simulator (in iOS8)
|
||||
#if !MONOMAC
|
||||
if (IsSimulator)
|
||||
return;
|
||||
#endif
|
||||
goto default;
|
||||
case "GameKit":
|
||||
#if !MONOMAC
|
||||
if (IsSimulator && App.Platform == Xamarin.Utils.ApplePlatform.WatchOS && App.SdkVersion < new Version (3, 2))
|
||||
return; // No headers provided for watchOS/simulator until watchOS 3.2.
|
||||
#endif
|
||||
goto default;
|
||||
case "WatchKit":
|
||||
// There's a bug in Xcode 7 beta 2 headers where the build fails with
|
||||
// ObjC++ files if WatchKit.h is included before UIKit.h (radar 21651022).
|
||||
|
@ -2154,12 +2137,6 @@ namespace Registrar {
|
|||
header.WriteLine ("#import <WatchKit/WatchKit.h>");
|
||||
namespaces.Add ("UIKit");
|
||||
return;
|
||||
case "DeviceCheck":
|
||||
#if !MONOMAC
|
||||
if (IsSimulator)
|
||||
return; // No headers provided for simulator
|
||||
#endif
|
||||
goto default;
|
||||
case "QTKit":
|
||||
#if MONOMAC
|
||||
if (App.SdkVersion >= MacOSTenTwelveVersion)
|
||||
|
@ -2167,10 +2144,6 @@ namespace Registrar {
|
|||
#endif
|
||||
goto default;
|
||||
case "IOSurface": // There is no IOSurface.h
|
||||
#if !MONOMAC
|
||||
if (IsSimulator)
|
||||
return; // Not available in the simulator (the header is there, but broken).
|
||||
#endif
|
||||
h = "<IOSurface/IOSurfaceObjC.h>";
|
||||
break;
|
||||
default:
|
||||
|
@ -2586,21 +2559,16 @@ namespace Registrar {
|
|||
static bool IsIntentsType (ObjCType type) => IsTypeCore (type, "Intents");
|
||||
static bool IsExternalAccessoryType (ObjCType type) => IsTypeCore (type, "ExternalAccessory");
|
||||
|
||||
static bool IsMetalType (ObjCType type)
|
||||
#if !MONOMAC
|
||||
bool IsTypeAllowedInSimulator (ObjCType type)
|
||||
{
|
||||
var ns = type.Type.Namespace;
|
||||
if (!IsDualBuild)
|
||||
ns = ns.Substring (CompatNamespace.Length + 1);
|
||||
|
||||
switch (ns) {
|
||||
case "Metal":
|
||||
case "MetalKit":
|
||||
case "MetalPerformanceShaders":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return Driver.IsFrameworkAvailableInSimulator (App, ns);
|
||||
}
|
||||
#endif
|
||||
|
||||
class ProtocolInfo
|
||||
{
|
||||
|
@ -2676,8 +2644,10 @@ namespace Registrar {
|
|||
|
||||
#if !MONOMAC
|
||||
var isPlatformType = IsPlatformType (@class.Type);
|
||||
if (isPlatformType && IsSimulatorOrDesktop && IsMetalType (@class))
|
||||
continue; // Metal isn't supported in the simulator.
|
||||
if (isPlatformType && IsSimulatorOrDesktop && !IsTypeAllowedInSimulator (@class)) {
|
||||
Driver.Log (5, "The static registrar won't generate code for {0} because its framework is not supported in the simulator.", @class.ExportedName);
|
||||
continue; // Some types are not supported in the simulator.
|
||||
}
|
||||
#else
|
||||
// Don't register 64-bit only API on 32-bit XM
|
||||
if (!Is64Bits && IsOnly64Bits (@class.Type))
|
||||
|
|
|
@ -32,13 +32,13 @@ namespace Xamarin.Linker {
|
|||
switch (CurrentAction) {
|
||||
case AssemblyAction.Link:
|
||||
case AssemblyAction.Save:
|
||||
SweepAssembly (assembly);
|
||||
SweepAssemblyDefinition (assembly);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void SweepAssembly (AssemblyDefinition assembly)
|
||||
protected virtual void SweepAssemblyDefinition (AssemblyDefinition assembly)
|
||||
{
|
||||
SweepMainModule (assembly.MainModule);
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ namespace MonoTouch.Tuner {
|
|||
{
|
||||
}
|
||||
|
||||
protected override void SweepAssembly (AssemblyDefinition assembly)
|
||||
protected override void SweepAssemblyDefinition (AssemblyDefinition assembly)
|
||||
{
|
||||
base.SweepAssembly (assembly);
|
||||
base.SweepAssemblyDefinition (assembly);
|
||||
|
||||
if (assembly.HasCustomAttributes)
|
||||
SweepAttributes (assembly.CustomAttributes);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>linker</RootNamespace>
|
||||
<AssemblyName>mmp</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<UseXamMacFullFramework>true</UseXamMacFullFramework>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
|
|
|
@ -273,6 +273,9 @@ SIMLAUNCHER_FRAMEWORKS = \
|
|||
-weak_framework WatchConnectivity \
|
||||
-weak_framework ModelIO \
|
||||
-weak_framework GameplayKit \
|
||||
-weak_framework Metal \
|
||||
-weak_framework MetalKit \
|
||||
-weak_framework MetalPerformanceShaders \
|
||||
\
|
||||
-weak_framework HealthKitUI \
|
||||
\
|
||||
|
@ -297,6 +300,7 @@ SIMLAUNCHER_FRAMEWORKS = \
|
|||
# note 2: there's no GameKit, in iOS 9 (beta 3 at least), you're supposed to reference GameCenter instead (looks fixed in beta 4)
|
||||
# note 3: there's no MetalKit or MetalPerformanceShaders in iOS 9 beta 4 - but other frameworks were added
|
||||
# note 4: GameCenter was removed in Xcode 7 beta 5, and GameKit is back.
|
||||
# note 5: Metal* seems to be supported as of some Xcode 7 beta (b2 didn't, but the final release does)
|
||||
|
||||
# keep the above list of weak_framework in sync with mtouch.cs
|
||||
# except it is no a mistake that GameController and MediaAccessibility (#13636) are not built into simlauncher
|
||||
|
|
|
@ -393,6 +393,10 @@ namespace Xamarin.Bundler
|
|||
}
|
||||
|
||||
var reference_assembly = ManifestResolver.Resolve (reference);
|
||||
if (reference_assembly == null) {
|
||||
ErrorHelper.Warning (136, "Cannot find the assembly '{0}' referenced from '{1}'.", reference.FullName, main.FileName);
|
||||
continue;
|
||||
}
|
||||
ComputeListOfAssemblies (assemblies, reference_assembly, exceptions);
|
||||
}
|
||||
|
||||
|
@ -402,39 +406,36 @@ namespace Xamarin.Bundler
|
|||
// Custom Attribute metadata can include references to other assemblies, e.g. [X (typeof (Y)],
|
||||
// but it is not reflected in AssemblyReferences :-( ref: #37611
|
||||
// so we must scan every custom attribute to look for System.Type
|
||||
GetCustomAttributeReferences (assembly, assemblies, exceptions);
|
||||
GetCustomAttributeReferences (main, assemblies, exceptions);
|
||||
if (main.HasTypes) {
|
||||
foreach (var ca in main.GetCustomAttributes ())
|
||||
GetCustomAttributeReferences (ca, assemblies, exceptions);
|
||||
}
|
||||
GetCustomAttributeReferences (main, main, assemblies, exceptions);
|
||||
foreach (var ca in main.GetCustomAttributes ())
|
||||
GetCustomAttributeReferences (main, ca, assemblies, exceptions);
|
||||
}
|
||||
|
||||
void GetCustomAttributeReferences (ICustomAttributeProvider cap, HashSet<string> assemblies, List<Exception> exceptions)
|
||||
void GetCustomAttributeReferences (ModuleDefinition main, ICustomAttributeProvider cap, HashSet<string> assemblies, List<Exception> exceptions)
|
||||
{
|
||||
if (!cap.HasCustomAttributes)
|
||||
return;
|
||||
foreach (var ca in cap.CustomAttributes)
|
||||
GetCustomAttributeReferences (ca, assemblies, exceptions);
|
||||
GetCustomAttributeReferences (main, ca, assemblies, exceptions);
|
||||
}
|
||||
|
||||
void GetCustomAttributeReferences (CustomAttribute ca, HashSet<string> assemblies, List<Exception> exceptions)
|
||||
void GetCustomAttributeReferences (ModuleDefinition main, CustomAttribute ca, HashSet<string> assemblies, List<Exception> exceptions)
|
||||
{
|
||||
if (ca.HasConstructorArguments) {
|
||||
foreach (var arg in ca.ConstructorArguments)
|
||||
GetCustomAttributeArgumentReference (arg, assemblies, exceptions);
|
||||
GetCustomAttributeArgumentReference (main, ca, arg, assemblies, exceptions);
|
||||
}
|
||||
if (ca.HasFields) {
|
||||
foreach (var arg in ca.Fields)
|
||||
GetCustomAttributeArgumentReference (arg.Argument, assemblies, exceptions);
|
||||
GetCustomAttributeArgumentReference (main, ca, arg.Argument, assemblies, exceptions);
|
||||
}
|
||||
if (ca.HasProperties) {
|
||||
foreach (var arg in ca.Properties)
|
||||
GetCustomAttributeArgumentReference (arg.Argument, assemblies, exceptions);
|
||||
GetCustomAttributeArgumentReference (main, ca, arg.Argument, assemblies, exceptions);
|
||||
}
|
||||
}
|
||||
|
||||
void GetCustomAttributeArgumentReference (CustomAttributeArgument arg, HashSet<string> assemblies, List<Exception> exceptions)
|
||||
void GetCustomAttributeArgumentReference (ModuleDefinition main, CustomAttribute ca, CustomAttributeArgument arg, HashSet<string> assemblies, List<Exception> exceptions)
|
||||
{
|
||||
if (!arg.Type.Is ("System", "Type"))
|
||||
return;
|
||||
|
@ -442,6 +443,10 @@ namespace Xamarin.Bundler
|
|||
if (ar == null)
|
||||
return;
|
||||
var reference_assembly = ManifestResolver.Resolve (ar);
|
||||
if (reference_assembly == null) {
|
||||
ErrorHelper.Warning (137, "Cannot find the assembly '{0}', referenced by a {2} attribute in '{1}'.", ar.FullName, main.Name, ca.AttributeType.FullName);
|
||||
return;
|
||||
}
|
||||
ComputeListOfAssemblies (assemblies, reference_assembly, exceptions);
|
||||
}
|
||||
|
||||
|
|
|
@ -1677,5 +1677,19 @@ namespace Xamarin.Bundler
|
|||
throw ErrorHelper.CreateError (71, "Unknown platform: {0}. This usually indicates a bug in Xamarin.iOS; please file a bug report at http://bugzilla.xamarin.com with a test case.", app.Platform);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsFrameworkAvailableInSimulator (Application app, string framework)
|
||||
{
|
||||
if (!GetFrameworks (app).TryGetValue (framework, out var fw))
|
||||
return true; // Unknown framework, assume it's valid for the simulator
|
||||
|
||||
if (fw.VersionAvailableInSimulator == null)
|
||||
return false;
|
||||
|
||||
if (fw.VersionAvailableInSimulator > app.SdkVersion)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -372,6 +372,12 @@
|
|||
<Compile Include="..\..\src\ObjCRuntime\BindingImplAttribute.cs">
|
||||
<Link>external\maccore\BindingImplAttribute.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\external\mono\external\linker\linker\Linker\AssemblyUtilities.cs">
|
||||
<Link>Linker\AssemblyUtilities.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\external\mono\external\linker\linker\Linker\TypeNameParser.cs">
|
||||
<Link>Linker\TypeNameParser.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Core" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче