[mtouch] Use fewer error numbers for code sharing failures.

This commit is contained in:
Rolf Bjarne Kvinge 2017-02-28 13:25:21 +01:00
Родитель 3f2915e595
Коммит 83d1111e10
3 изменённых файлов: 86 добавлений и 78 удалений

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

@ -447,71 +447,79 @@ No action is required on your part, this message is purely informational.
For further information see bug #[51634](https://bugzilla.xamarin.com/show_bug.cgi?id=51634). For further information see bug #[51634](https://bugzilla.xamarin.com/show_bug.cgi?id=51634).
<h3><a name="MT0112"/>MT0112: Native code sharing has been disabled because the container app's deployment target is earlier than iOS 8.0 (it's *)).</h3>
<h3><a name="MT0112"/>MT0112: Native code sharing has been disabled because *</h3>
There are multiple reasons code sharing can be disabled:
* because the container app's deployment target is earlier than iOS 8.0 (it's *)).
Native code sharing requires iOS 8.0 because native code sharing is implemented using user frameworks, which was introduced with iOS 8.0. Native code sharing requires iOS 8.0 because native code sharing is implemented using user frameworks, which was introduced with iOS 8.0.
<h3><a name="MT0113"/>MT0113: Native code sharing has been disabled because the container app includes I18N assemblies (*).</h3> * because the container app includes I18N assemblies (*).
Native code sharing is currently not supported if the container app includes I18N assemblies. Native code sharing is currently not supported if the container app includes I18N assemblies.
<h3><a name="MT0114"/>MT0114: Native code sharing has been disabled for the extension '*' because the bitcode options differ between the container app (*) and the extension (*).</h3> * because the container app has custom xml definitions for the managed linker (*).
Native code sharing requires is not supported for projects that use custom xml definitions for the managed linker.
<h3><a name="MT0113"/>MT0113: Native code sharing has been disabled for the extension '*' because *.</h3>
* because the bitcode options differ between the container app (*) and the extension (*).
Native code sharing requires that the bitcode options match between the projects that share code. Native code sharing requires that the bitcode options match between the projects that share code.
<h3><a name="MT0115"/>MT0115: Native code sharing has been disabled for the extension '*' because the --assembly-build-target options are different between the container app (*) and the extension (*).</h3> * because the --assembly-build-target options are different between the container app (*) and the extension (*).
Native code sharing requires that the --assembly-build-target options are identical between the projects that share code. Native code sharing requires that the --assembly-build-target options are identical between the projects that share code.
This condition can occur if incremental builds are not either enabled or disabled in all the projects. This condition can occur if incremental builds are not either enabled or disabled in all the projects.
<h3><a name="MT0116"/>MT0116: Native code sharing has been disabled for the extension '*' because the I18N assemblies are different between the container app (*) and the extension (*).</h3> * because the I18N assemblies are different between the container app (*) and the extension (*).
Native code sharing is currently not supported for extensions that include I18N assemblies. Native code sharing is currently not supported for extensions that include I18N assemblies.
<h3><a name="MT0117"/>MT0117: Native code sharing has been disabled for the extension '*' because the arguments to the AOT compiler are different between the container app (*) and the extension (*).</h3> * because the arguments to the AOT compiler are different between the container app (*) and the extension (*).
Native code sharing requires that the arguments to the AOT compiler do not differ between projects that share code. Native code sharing requires that the arguments to the AOT compiler do not differ between projects that share code.
<h3><a name="MT0118"/>MT0118: Native code sharing has been disabled for the extension '*' because the other arguments to the AOT compiler are different between the container app (*) and the extension (*).</h3> * because the other arguments to the AOT compiler are different between the container app (*) and the extension (*).
Native code sharing requires that the arguments to the AOT compiler do not differ between projects that share code. Native code sharing requires that the arguments to the AOT compiler do not differ between projects that share code.
This condition occurs if the 'Perform all 32-bit float operations as 64-bit float' differs between projects. This condition occurs if the 'Perform all 32-bit float operations as 64-bit float' differs between projects.
<h3><a name="MT0119"/>MT0119: Native code sharing has been disabled for the extension '*' because LLVM is not enabled or disabled in both the container app (*) and the extension (*).</h3> + because LLVM is not enabled or disabled in both the container app (*) and the extension (*).
Native code sharing requires that LLVM is either enabled or disabled for all projects that share code. Native code sharing requires that LLVM is either enabled or disabled for all projects that share code.
<h3><a name="MT0120"/>MT0120: Native code sharing has been disabled for the extension '*' because the managed linker settings are different between the container app (*) and the extension (*).</h3> * because the managed linker settings are different between the container app (*) and the extension (*).
Native code sharing requires that the managed linker settings are identical for all projects that share code. Native code sharing requires that the managed linker settings are identical for all projects that share code.
<h3><a name="MT0121"/>MT0121: Native code sharing has been disabled for the extension '*' because the skipped assemblies for the managed linker are different between the container app (*) and the extension (*).</h3> * because the skipped assemblies for the managed linker are different between the container app (*) and the extension (*).
Native code sharing requires that the managed linker settings are identical for all projects that share code. Native code sharing requires that the managed linker settings are identical for all projects that share code.
<h3><a name="MT0122"/>MT0122: Native code sharing has been disabled because the container app has custom xml definitions for the managed linker (*).</h3> * because the extension has custom xml definitions for the managed linker (*).
Native code sharing requires is not supported for projects that use custom xml definitions for the managed linker. Native code sharing requires is not supported for projects that use custom xml definitions for the managed linker.
<h3><a name="MT0123"/>MT0123: Native code sharing has been disabled for the extension '*' because the extension has custom xml definitions for the managed linker (*).</h3> * because the container app does not build for the ABI * (while the extension is building for this ABI).
Native code sharing requires is not supported for projects that use custom xml definitions for the managed linker.
<h3><a name="MT0124"/>MT0124: Native code sharing has been disabled for the extension '*' because the container app does not build for the ABI * (while the extension is building for this ABI).</h3>
Native code sharing requires that the container app builds for all the architectures any app extension builds for. Native code sharing requires that the container app builds for all the architectures any app extension builds for.
For instance: this condition occurs when an extension builds for ARM64+ARMv7, but the container app only builds for ARM64. For instance: this condition occurs when an extension builds for ARM64+ARMv7, but the container app only builds for ARM64.
<h3><a name="MT0125"/>MT0125: Native code sharing has been disabled for the extension '*' because the container app is building for the ABI *, which is not compatible with the extension's ABI (*).</h3> * because the container app is building for the ABI *, which is not compatible with the extension's ABI (*).
Native code sharing requires that all the projects build for the exact same API. Native code sharing requires that all the projects build for the exact same API.
For instance: this condition occurs when an extension builds for ARMv7+llvm+thumb2, but the container app only builds for ARMv7+llvm. For instance: this condition occurs when an extension builds for ARMv7+llvm+thumb2, but the container app only builds for ARMv7+llvm.
<h3><a name="MT0126"/>MT0126: Native code sharing has been disabled for the extension '{0}' because the container app is referencing the assembly '{1}' from '{2}', while the extension references it from '{3}'.</h3> * because the container app is referencing the assembly '*' from '*', while the extension references it from '*'.
Native code sharing requires that all the projects that share code use the same versions for all assemblies. Native code sharing requires that all the projects that share code use the same versions for all assemblies.

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

@ -909,7 +909,7 @@ namespace Xamarin
/* MT0109 is tested in other tests (MT2018) */ /* MT0109 is tested in other tests (MT2018) */
[Test] [Test]
public void MT0112 () public void MT0112_deploymenttarget ()
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -928,7 +928,7 @@ namespace Xamarin
} }
[Test] [Test]
public void MT0113 () public void MT0112_i18n ()
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -939,15 +939,15 @@ namespace Xamarin
app.CreateTemporaryApp (); app.CreateTemporaryApp ();
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.I18N = I18N.CJK; app.I18N = I18N.CJK;
app.WarnAsError = new int [] { 113 }; app.WarnAsError = new int [] { 112 };
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (113, "Native code sharing has been disabled because the container app includes I18N assemblies (CJK)."); app.AssertError (112, "Native code sharing has been disabled because the container app includes I18N assemblies (CJK).");
} }
} }
} }
[Test] [Test]
public void MT0114 () public void MT0113_bitcode ()
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -959,9 +959,9 @@ namespace Xamarin
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.Abi = "arm64+llvm"; app.Abi = "arm64+llvm";
app.Bitcode = MTouchBitcode.Full; app.Bitcode = MTouchBitcode.Full;
app.WarnAsError = new int [] { 114 }; app.WarnAsError = new int [] { 113 };
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (114, "Native code sharing has been disabled for the extension 'testServiceExtension' because the bitcode options differ between the container app (None) and the extension (LLVMOnly)."); app.AssertError (113, "Native code sharing has been disabled for the extension 'testServiceExtension' because the bitcode options differ between the container app (None) and the extension (LLVMOnly).");
} }
} }
} }
@ -971,7 +971,7 @@ namespace Xamarin
[TestCase ("framework ext", null, new string [] { "@sdk=framework=Xamarin.Sdk" })] [TestCase ("framework ext", null, new string [] { "@sdk=framework=Xamarin.Sdk" })]
[TestCase ("fastdev app", new string [] { "@all=dynamiclibrary" }, null)] [TestCase ("fastdev app", new string [] { "@all=dynamiclibrary" }, null)]
[TestCase ("fastdev ext", null, new string [] { "@all=dynamiclibrary" })] [TestCase ("fastdev ext", null, new string [] { "@all=dynamiclibrary" })]
public void MT0115 (string name, string[] extension_abt, string[] app_abt) public void MT0113_assemblybuildtarget (string name, string[] extension_abt, string[] app_abt)
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -983,17 +983,17 @@ namespace Xamarin
app.AppExtensions.Add (extension); app.AppExtensions.Add (extension);
app.CreateTemporaryApp (); app.CreateTemporaryApp ();
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.WarnAsError = new int [] { 115 }; app.WarnAsError = new int [] { 113 };
if (app_abt != null) if (app_abt != null)
app.AssemblyBuildTargets.AddRange (app_abt); app.AssemblyBuildTargets.AddRange (app_abt);
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (115, $"Native code sharing has been disabled for the extension 'testServiceExtension' because the --assembly-build-target options are different between the container app ({(app_abt == null ? string.Empty : string.Join (", ", app_abt.Select ((v) => "--assembly-build-target:" + v)))}) and the extension ({(extension_abt == null ? string.Empty : string.Join (", ", extension_abt?.Select ((v) => "--assembly-build-target:" + v)))})."); app.AssertError (113, $"Native code sharing has been disabled for the extension 'testServiceExtension' because the --assembly-build-target options are different between the container app ({(app_abt == null ? string.Empty : string.Join (", ", app_abt.Select ((v) => "--assembly-build-target:" + v)))}) and the extension ({(extension_abt == null ? string.Empty : string.Join (", ", extension_abt?.Select ((v) => "--assembly-build-target:" + v)))}).");
} }
} }
} }
[Test] [Test]
public void MT0116 () public void MT0113_i18n ()
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -1004,15 +1004,15 @@ namespace Xamarin
app.AppExtensions.Add (extension); app.AppExtensions.Add (extension);
app.CreateTemporaryApp (); app.CreateTemporaryApp ();
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.WarnAsError = new int [] { 116 }; app.WarnAsError = new int [] { 113 };
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (116, "Native code sharing has been disabled for the extension 'testServiceExtension' because the I18N assemblies are different between the container app (None) and the extension (CJK)."); app.AssertError (113, "Native code sharing has been disabled for the extension 'testServiceExtension' because the I18N assemblies are different between the container app (None) and the extension (CJK).");
} }
} }
} }
[Test] [Test]
public void MT0117 () public void MT0113_aot ()
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -1022,16 +1022,16 @@ namespace Xamarin
app.AppExtensions.Add (extension); app.AppExtensions.Add (extension);
app.CreateTemporaryApp (); app.CreateTemporaryApp ();
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.WarnAsError = new int [] { 117 }; app.WarnAsError = new int [] { 113 };
app.AotArguments = "dwarfdebug"; // doesn't matter exactly what, just that it's different from the extension. app.AotArguments = "dwarfdebug"; // doesn't matter exactly what, just that it's different from the extension.
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (117, "Native code sharing has been disabled for the extension 'testServiceExtension' because the arguments to the AOT compiler are different between the container app (dwarfdebug,static,asmonly,direct-icalls,) and the extension (static,asmonly,direct-icalls,)."); app.AssertError (113, "Native code sharing has been disabled for the extension 'testServiceExtension' because the arguments to the AOT compiler are different between the container app (dwarfdebug,static,asmonly,direct-icalls,) and the extension (static,asmonly,direct-icalls,).");
} }
} }
} }
[Test] [Test]
public void MT0118 () public void MT0113_aotother ()
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -1041,16 +1041,16 @@ namespace Xamarin
app.AppExtensions.Add (extension); app.AppExtensions.Add (extension);
app.CreateTemporaryApp (); app.CreateTemporaryApp ();
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.WarnAsError = new int [] { 118 }; app.WarnAsError = new int [] { 113 };
app.AotOtherArguments = "--aot-options=-O=float32"; // doesn't matter exactly what, just that it's different from the extension. app.AotOtherArguments = "--aot-options=-O=float32"; // doesn't matter exactly what, just that it's different from the extension.
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (118, "Native code sharing has been disabled for the extension 'testServiceExtension' because the other arguments to the AOT compiler are different between the container app (--aot-options=-O=float32 ) and the extension ()."); app.AssertError (113, "Native code sharing has been disabled for the extension 'testServiceExtension' because the other arguments to the AOT compiler are different between the container app (--aot-options=-O=float32 ) and the extension ().");
} }
} }
} }
[Test] [Test]
public void MT0119 () public void MT0113_llvm ()
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -1061,16 +1061,16 @@ namespace Xamarin
app.AppExtensions.Add (extension); app.AppExtensions.Add (extension);
app.CreateTemporaryApp (); app.CreateTemporaryApp ();
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.WarnAsError = new int [] { 119 }; app.WarnAsError = new int [] { 113 };
app.Abi = "arm64+llvm"; app.Abi = "arm64+llvm";
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (119, "Native code sharing has been disabled for the extension 'testServiceExtension' because LLVM is not enabled or disabled in both the container app (True) and the extension (False)."); app.AssertError (113, "Native code sharing has been disabled for the extension 'testServiceExtension' because LLVM is not enabled or disabled in both the container app (True) and the extension (False).");
} }
} }
} }
[Test] [Test]
public void MT0120 () public void MT0113_linker ()
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -1083,15 +1083,15 @@ namespace Xamarin
app.CreateTemporaryApp (); app.CreateTemporaryApp ();
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.Linker = MTouchLinker.DontLink; app.Linker = MTouchLinker.DontLink;
app.WarnAsError = new int [] { 120 }; app.WarnAsError = new int [] { 113 };
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (120, "Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All)."); app.AssertError (113, "Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).");
} }
} }
} }
[Test] [Test]
public void MT0121 () public void MT0113_skipped ()
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -1101,16 +1101,16 @@ namespace Xamarin
app.AppExtensions.Add (extension); app.AppExtensions.Add (extension);
app.CreateTemporaryApp (); app.CreateTemporaryApp ();
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.WarnAsError = new int [] { 121 }; app.WarnAsError = new int [] { 113 };
app.LinkSkip = new string [] { "mscorlib.dll" }; app.LinkSkip = new string [] { "mscorlib.dll" };
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (121, "Native code sharing has been disabled for the extension 'testServiceExtension' because the skipped assemblies for the managed linker are different between the container app (mscorlib.dll) and the extension ()."); app.AssertError (113, "Native code sharing has been disabled for the extension 'testServiceExtension' because the skipped assemblies for the managed linker are different between the container app (mscorlib.dll) and the extension ().");
} }
} }
} }
[Test] [Test]
public void MT0122 () public void MT0112_xml ()
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -1120,16 +1120,16 @@ namespace Xamarin
app.AppExtensions.Add (extension); app.AppExtensions.Add (extension);
app.CreateTemporaryApp (); app.CreateTemporaryApp ();
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.WarnAsError = new int [] { 122 }; app.WarnAsError = new int [] { 112 };
app.XmlDefinitions = new string [] { "foo.xml" }; app.XmlDefinitions = new string [] { "foo.xml" };
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (122, "Native code sharing has been disabled because the container app has custom xml definitions for the managed linker (foo.xml)."); app.AssertError (112, "Native code sharing has been disabled because the container app has custom xml definitions for the managed linker (foo.xml).");
} }
} }
} }
[Test] [Test]
public void MT0123 () public void MT0113_xml ()
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -1140,9 +1140,9 @@ namespace Xamarin
app.AppExtensions.Add (extension); app.AppExtensions.Add (extension);
app.CreateTemporaryApp (); app.CreateTemporaryApp ();
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.WarnAsError = new int [] { 123 }; app.WarnAsError = new int [] { 113 };
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (123, "Native code sharing has been disabled for the extension 'testServiceExtension' because the extension has custom xml definitions for the managed linker (foo.xml)."); app.AssertError (113, "Native code sharing has been disabled for the extension 'testServiceExtension' because the extension has custom xml definitions for the managed linker (foo.xml).");
} }
} }
} }
@ -1150,7 +1150,7 @@ namespace Xamarin
[Test] [Test]
[TestCase ("arm64", "armv7", "ARMv7")] [TestCase ("arm64", "armv7", "ARMv7")]
[TestCase ("armv7", "armv7,arm64", "ARM64")] [TestCase ("armv7", "armv7,arm64", "ARM64")]
public void MT0124 (string app_abi, string extension_abi, string error_abi) public void MT0113_abi (string app_abi, string extension_abi, string error_abi)
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -1161,17 +1161,17 @@ namespace Xamarin
app.AppExtensions.Add (extension); app.AppExtensions.Add (extension);
app.CreateTemporaryApp (); app.CreateTemporaryApp ();
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.WarnAsError = new int [] { 124 }; app.WarnAsError = new int [] { 113 };
app.Abi = app_abi; app.Abi = app_abi;
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (124, $"Native code sharing has been disabled for the extension 'testServiceExtension' because the container app does not build for the ABI {error_abi} (while the extension is building for this ABI)."); app.AssertError (113, $"Native code sharing has been disabled for the extension 'testServiceExtension' because the container app does not build for the ABI {error_abi} (while the extension is building for this ABI).");
} }
} }
} }
[Test] [Test]
[TestCase ("armv7+llvm+thumb2", "armv7+llvm", "ARMv7, Thumb, LLVM", "ARMv7, LLVM")] [TestCase ("armv7+llvm+thumb2", "armv7+llvm", "ARMv7, Thumb, LLVM", "ARMv7, LLVM")]
public void MT0125 (string app_abi, string extension_abi, string container_error_abi, string extension_error_abi) public void MT0113_incompatible_abi (string app_abi, string extension_abi, string container_error_abi, string extension_error_abi)
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (); extension.CreateTemporaryServiceExtension ();
@ -1182,16 +1182,16 @@ namespace Xamarin
app.AppExtensions.Add (extension); app.AppExtensions.Add (extension);
app.CreateTemporaryApp (); app.CreateTemporaryApp ();
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.WarnAsError = new int [] { 125 }; app.WarnAsError = new int [] { 113 };
app.Abi = app_abi; app.Abi = app_abi;
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (125, $"Native code sharing has been disabled for the extension 'testServiceExtension' because the container app is building for the ABI {container_error_abi}, which is not compatible with the extension's ABI ({extension_error_abi})."); app.AssertError (113, $"Native code sharing has been disabled for the extension 'testServiceExtension' because the container app is building for the ABI {container_error_abi}, which is not compatible with the extension's ABI ({extension_error_abi}).");
} }
} }
} }
[Test] [Test]
public void MT0126 () public void MT0113_refmismatch ()
{ {
using (var extension = new MTouchTool ()) { using (var extension = new MTouchTool ()) {
var ext_tmpdir = extension.CreateTemporaryDirectory (); var ext_tmpdir = extension.CreateTemporaryDirectory ();
@ -1210,9 +1210,9 @@ namespace Xamarin
app.CreateTemporaryApp (extraCode: "class Y : X {}", extraArg: $"-r:{Quote (app_dll)}"); app.CreateTemporaryApp (extraCode: "class Y : X {}", extraArg: $"-r:{Quote (app_dll)}");
app.CreateTemporaryCacheDirectory (); app.CreateTemporaryCacheDirectory ();
app.References = new string [] { app_dll }; app.References = new string [] { app_dll };
app.WarnAsError = new int [] { 126 }; app.WarnAsError = new int [] { 113 };
app.AssertExecuteFailure (MTouchAction.BuildDev, "build app"); app.AssertExecuteFailure (MTouchAction.BuildDev, "build app");
app.AssertError (126, $"Native code sharing has been disabled for the extension 'testServiceExtension' because the container app is referencing the assembly 'testLibrary' from '{app_dll}', while the extension references it from '{ext_dll}'."); app.AssertError (113, $"Native code sharing has been disabled for the extension 'testServiceExtension' because the container app is referencing the assembly 'testLibrary' from '{app_dll}', while the extension references it from '{ext_dll}'.");
} }
} }
} }

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

@ -908,14 +908,14 @@ namespace Xamarin.Bundler {
if (DeploymentTarget.Major < 8) { if (DeploymentTarget.Major < 8) {
// This is a limitation it's technically possible to fix (we can build all extensions into frameworks, and the main app to static objects). // This is a limitation it's technically possible to fix (we can build all extensions into frameworks, and the main app to static objects).
// It would make our code a bit more complicated though, and would only be valuable for apps that target iOS 6 or iOS 7 and has more than one extension. // It would make our code a bit more complicated though, and would only be valuable for apps that target iOS 6 or iOS 7 and has more than one extension.
ErrorHelper.Warning (112, "Native code sharing has been disabled because the container app's deployment target is earlier than iOS 8.0 (it's {0}).", DeploymentTarget); ErrorHelper.Warning (112, "Native code sharing has been disabled because {0}", $"the container app's deployment target is earlier than iOS 8.0 (it's {DeploymentTarget}).");
return; return;
} }
// No I18N assemblies can be included // No I18N assemblies can be included
if (I18n != Mono.Linker.I18nAssemblies.None) { if (I18n != Mono.Linker.I18nAssemblies.None) {
// This is a limitation it's technically possible to fix. // This is a limitation it's technically possible to fix.
ErrorHelper.Warning (113, "Native code sharing has been disabled because the container app includes I18N assemblies ({0}).", I18n); ErrorHelper.Warning (112, "Native code sharing has been disabled because the container app includes I18N assemblies ({0}).", I18n);
return; return;
} }
@ -933,7 +933,7 @@ namespace Xamarin.Bundler {
} }
if (BitCodeMode != appex.BitCodeMode) { if (BitCodeMode != appex.BitCodeMode) {
ErrorHelper.Warning (114, "Native code sharing has been disabled for the extension '{0}' because the bitcode options differ between the container app ({1}) and the extension ({2}).", appex.Name, appex.BitCodeMode, BitCodeMode); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"the bitcode options differ between the container app ({appex.BitCodeMode}) and the extension ({BitCodeMode}).");
continue; continue;
} }
@ -942,21 +942,21 @@ namespace Xamarin.Bundler {
// We can probably lift this requirement (at least partially) at some point, // We can probably lift this requirement (at least partially) at some point,
// but for now it makes our code simpler. // but for now it makes our code simpler.
if (assembly_build_targets.Count != appex.assembly_build_targets.Count) { if (assembly_build_targets.Count != appex.assembly_build_targets.Count) {
ErrorHelper.Warning (115, "Native code sharing has been disabled for the extension '{0}' because the --assembly-build-target options are different between the container app ({1}) and the extension ({2}).", appex.Name, FormatAssemblyBuildTargets (), appex.FormatAssemblyBuildTargets ()); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"the --assembly-build-target options are different between the container app ({FormatAssemblyBuildTargets ()}) and the extension ({appex.FormatAssemblyBuildTargets ()}).");
continue; continue;
} }
foreach (var key in assembly_build_targets.Keys) { foreach (var key in assembly_build_targets.Keys) {
Tuple<AssemblyBuildTarget, string> appex_value; Tuple<AssemblyBuildTarget, string> appex_value;
if (!appex.assembly_build_targets.TryGetValue (key, out appex_value)) { if (!appex.assembly_build_targets.TryGetValue (key, out appex_value)) {
ErrorHelper.Warning (115, "Native code sharing has been disabled for the extension '{0}' because the --assembly-build-target options are different between the container app ({1}) and the extension ({2}).", appex.Name, FormatAssemblyBuildTargets (), appex.FormatAssemblyBuildTargets ()); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"the --assembly-build-target options are different between the container app ({FormatAssemblyBuildTargets ()}) and the extension ({appex.FormatAssemblyBuildTargets ()}).");
applicable = false; applicable = false;
break; break;
} }
var value = assembly_build_targets [key]; var value = assembly_build_targets [key];
if (value.Item1 != appex_value.Item1 || value.Item2 != appex_value.Item2) { if (value.Item1 != appex_value.Item1 || value.Item2 != appex_value.Item2) {
ErrorHelper.Warning (115, "Native code sharing has been disabled for the extension '{0}' because the --assembly-build-target options are different between the container app ({1}) and the extension ({2}).", appex.Name, FormatAssemblyBuildTargets (), appex.FormatAssemblyBuildTargets ()); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"the --assembly-build-target options are different between the container app ({FormatAssemblyBuildTargets ()}) and the extension ({appex.FormatAssemblyBuildTargets ()}).");
applicable = false; applicable = false;
break; break;
} }
@ -967,45 +967,45 @@ namespace Xamarin.Bundler {
// No I18N assemblies can be included // No I18N assemblies can be included
if (appex.I18n != Mono.Linker.I18nAssemblies.None) { if (appex.I18n != Mono.Linker.I18nAssemblies.None) {
ErrorHelper.Warning (116, "Native code sharing has been disabled for the extension '{0}' because the I18N assemblies are different between the container app ({1}) and the extension ({2}).", appex.Name, I18n, appex.I18n); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"the I18N assemblies are different between the container app ({I18n}) and the extension ({appex.I18n}).");
continue; continue;
} }
// All arguments to the AOT compiler must be identical // All arguments to the AOT compiler must be identical
if (AotArguments != appex.AotArguments) { if (AotArguments != appex.AotArguments) {
ErrorHelper.Warning (117, "Native code sharing has been disabled for the extension '{0}' because the arguments to the AOT compiler are different between the container app ({1}) and the extension ({2}).", appex.Name, AotArguments, appex.AotArguments); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"the arguments to the AOT compiler are different between the container app ({AotArguments}) and the extension ({appex.AotArguments}).");
continue; continue;
} }
if (AotOtherArguments != appex.AotOtherArguments) { if (AotOtherArguments != appex.AotOtherArguments) {
ErrorHelper.Warning (118, "Native code sharing has been disabled for the extension '{0}' because the other arguments to the AOT compiler are different between the container app ({1}) and the extension ({2}).", appex.Name, AotOtherArguments, appex.AotOtherArguments); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"the other arguments to the AOT compiler are different between the container app ({AotOtherArguments}) and the extension ({appex.AotOtherArguments}).");
continue; continue;
} }
if (IsLLVM != appex.IsLLVM) { if (IsLLVM != appex.IsLLVM) {
ErrorHelper.Warning (119, "Native code sharing has been disabled for the extension '{0}' because LLVM is not enabled or disabled in both the container app ({1}) and the extension ({2}).", appex.Name, IsLLVM, appex.IsLLVM); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"LLVM is not enabled or disabled in both the container app ({IsLLVM}) and the extension ({appex.IsLLVM}).");
continue; continue;
} }
if (LinkMode != appex.LinkMode) { if (LinkMode != appex.LinkMode) {
ErrorHelper.Warning (120, "Native code sharing has been disabled for the extension '{0}' because the managed linker settings are different between the container app ({1}) and the extension ({2}).", appex.Name, LinkMode, appex.LinkMode); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"the managed linker settings are different between the container app ({LinkMode}) and the extension ({appex.LinkMode}).");
continue; continue;
} }
if (LinkMode != LinkMode.None) { if (LinkMode != LinkMode.None) {
var linkskipped_same = !LinkSkipped.Except (appex.LinkSkipped).Any () && !appex.LinkSkipped.Except (LinkSkipped).Any (); var linkskipped_same = !LinkSkipped.Except (appex.LinkSkipped).Any () && !appex.LinkSkipped.Except (LinkSkipped).Any ();
if (!linkskipped_same) { if (!linkskipped_same) {
ErrorHelper.Warning (121, "Native code sharing has been disabled for the extension '{0}' because the skipped assemblies for the managed linker are different between the container app ({1}) and the extension ({2}).", appex.Name, string.Join (", ", LinkSkipped), string.Join (", ", appex.LinkSkipped)); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"the skipped assemblies for the managed linker are different between the container app ({string.Join (", ", LinkSkipped)}) and the extension ({string.Join (", ", appex.LinkSkipped)}).");
continue; continue;
} }
if (Definitions.Count > 0) { if (Definitions.Count > 0) {
ErrorHelper.Warning (122, "Native code sharing has been disabled because the container app has custom xml definitions for the managed linker ({0}).", string.Join (", ", Definitions)); ErrorHelper.Warning (112, "Native code sharing has been disabled because {0}", $"the container app has custom xml definitions for the managed linker ({string.Join (", ", Definitions)}).");
continue; continue;
} }
if (appex.Definitions.Count > 0) { if (appex.Definitions.Count > 0) {
ErrorHelper.Warning (123, "Native code sharing has been disabled for the extension '{0}' because the extension has custom xml definitions for the managed linker ({1}).", appex.Name, string.Join (", ", appex.Definitions)); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"the extension has custom xml definitions for the managed linker ({string.Join (", ", appex.Definitions)}).");
continue; continue;
} }
} }
@ -1015,12 +1015,12 @@ namespace Xamarin.Bundler {
var matching = abis.FirstOrDefault ((v) => (v & Abi.ArchMask) == (abi & Abi.ArchMask)); var matching = abis.FirstOrDefault ((v) => (v & Abi.ArchMask) == (abi & Abi.ArchMask));
if (matching == Abi.None) { if (matching == Abi.None) {
// Example: extension has arm64+armv7, while the main app has only arm64. // Example: extension has arm64+armv7, while the main app has only arm64.
ErrorHelper.Warning (124, "Native code sharing has been disabled for the extension '{0}' because the container app does not build for the ABI {1} (while the extension is building for this ABI).", appex.Name, abi); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"the container app does not build for the ABI {abi} (while the extension is building for this ABI).");
applicable = false; applicable = false;
break; break;
} else if (matching != abi) { } else if (matching != abi) {
// Example: extension has arm64+llvm, while the main app has only arm64. // Example: extension has arm64+llvm, while the main app has only arm64.
ErrorHelper.Warning (125, "Native code sharing has been disabled for the extension '{0}' because the container app is building for the ABI {1}, which is not compatible with the extension's ABI ({2}).", appex.Name, matching, abi); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"the container app is building for the ABI {matching}, which is not compatible with the extension's ABI ({abi}).");
applicable = false; applicable = false;
break; break;
} }
@ -1037,7 +1037,7 @@ namespace Xamarin.Bundler {
continue; // appex references an assembly the main app doesn't. This is fine. continue; // appex references an assembly the main app doesn't. This is fine.
if (asm.FullPath != kvp.Value.FullPath) { if (asm.FullPath != kvp.Value.FullPath) {
applicable = false; // app references an assembly with the same name as the main app, but from a different location. This is not fine. applicable = false; // app references an assembly with the same name as the main app, but from a different location. This is not fine.
ErrorHelper.Warning (126, "Native code sharing has been disabled for the extension '{0}' because the container app is referencing the assembly '{1}' from '{2}', while the extension references it from '{3}'.", appex.Name, asm.Identity, asm.FullPath, kvp.Value.FullPath); ErrorHelper.Warning (113, "Native code sharing has been disabled for the extension '{0}' because {1}", appex.Name, $"the container app is referencing the assembly '{asm.Identity}' from '{asm.FullPath}', while the extension references it from '{kvp.Value.FullPath}'.");
break; break;
} }
} }