public void Invalid_ABI(Platform platform, string abi) { var dll = CompileLibrary(platform); string valid; switch (platform) { case Platform.iOS: valid = "armv7, armv7s, arm64, i386, x86_64"; break; case Platform.macOS: valid = "x86_64"; break; case Platform.tvOS: valid = "arm64, x86_64"; break; case Platform.watchOS: valid = "armv7k, i386"; break; default: throw new NotImplementedException(); } Asserts.ThrowsEmbeddinatorException(8, $"The architecture '{abi}' is not valid for {platform}. Valid architectures for {platform} are: {valid}", () => Driver.Main2("--platform", platform.ToString(), "--abi", abi, "-c", dll, "-o", Xamarin.Cache.CreateTemporaryDirectory())); }
public void EM0013() { var tmpdir = Xamarin.Cache.CreateTemporaryDirectory(); var csfile = Path.Combine(tmpdir, "foo.cs"); var dllfile = Path.Combine(tmpdir, "foo.dll"); File.WriteAllText(csfile, @"public class C { public Foundation.NSObject F () { throw new System.NotImplementedException (); } }"); Asserts.RunProcess("/Library/Frameworks/Mono.framework/Commands/csc", $"/target:library /out:{Embedder.Quote (dllfile)} {Embedder.Quote (csfile)} -r:/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Xamarin.iOS.dll", "compile dll"); Asserts.ThrowsEmbeddinatorException(13, "Can't find the assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065', referenced by 'foo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.", () => Driver.Main2(dllfile, "--platform=tvOS", "--outdir=" + tmpdir)); }
public void CompilationTarget() { var embedder = new Embedder(); Asserts.ThrowsEmbeddinatorException(5, "The compilation target `invalid` is not valid.", () => Driver.Main2(new [] { "--target=invalid" })); Asserts.ThrowsEmbeddinatorException(5, "The compilation target `invalid` is not valid.", () => embedder.SetCompilationTarget("invalid")); foreach (var ct in new string [] { "library", "sharedlibrary", "dylib" }) { embedder.SetCompilationTarget(ct); Assert.That(embedder.CompilationTarget, Is.EqualTo(global::Embeddinator.CompilationTarget.SharedLibrary), ct); } foreach (var ct in new string [] { "framework" }) { embedder.SetCompilationTarget(ct); Assert.That(embedder.CompilationTarget, Is.EqualTo(global::Embeddinator.CompilationTarget.Framework), ct); } foreach (var ct in new string [] { "static", "staticlibrary" }) { embedder.SetCompilationTarget(ct); Assert.That(embedder.CompilationTarget, Is.EqualTo(global::Embeddinator.CompilationTarget.StaticLibrary), ct); } }
public void EM0011() { Asserts.ThrowsEmbeddinatorException(11, "The assembly foo.dll does not exist.", () => Driver.Main2("foo.dll")); }