public void CreateAppBundleDependsOnTest(ApplePlatform platform) { Configuration.IgnoreIfIgnoredPlatform(platform); var magic = Guid.NewGuid().ToString(); var csproj = $@"<Project Sdk=""Microsoft.NET.Sdk""> <PropertyGroup> <TargetFramework>{platform.ToFramework ()}</TargetFramework> <OutputType>Exe</OutputType> <CreateAppBundleDependsOn>FailTheBuild;$(CreateAppBundleDependsOn)</CreateAppBundleDependsOn> </PropertyGroup> <Target Name=""FailTheBuild""> <Error Text=""{magic}"" /> </Target> </Project>"; var tmpdir = Cache.CreateTemporaryDirectory(); Configuration.CopyDotNetSupportingFiles(tmpdir); var project_path = Path.Combine(tmpdir, "TestProject.csproj"); File.WriteAllText(project_path, csproj); File.WriteAllText(Path.Combine(tmpdir, "Info.plist"), EmptyAppManifest); File.WriteAllText(Path.Combine(tmpdir, "Main.cs"), EmptyMainFile); var properties = GetDefaultProperties(); var result = DotNet.AssertBuildFailure(project_path, properties); var errors = BinLog.GetBuildLogErrors(result.BinLogPath); Assert.That(errors, Has.Some.Matches <BuildLogEvent> (v => v.Message.Contains(magic)), "Expected error"); }
public void BuildMyWatchApp () { Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.WatchOS); var project_path = GetProjectPath ("MyWatchApp"); Clean (project_path); var result = DotNet.AssertBuildFailure (project_path, verbosity); Assert.That (result.StandardOutput.ToString (), Does.Contain ("The specified RuntimeIdentifier 'watchos-x86' is not recognized."), "Missing runtime pack for watchOS"); }
[TestCase(ApplePlatform.MacCatalyst, "osx-x64")] // valid RID for another platform public void InvalidRuntimeIdentifier(ApplePlatform platform, string runtimeIdentifier) { var project = "MySimpleApp"; Configuration.IgnoreIfIgnoredPlatform(platform); var project_path = GetProjectPath(project, platform: platform); Clean(project_path); var properties = GetDefaultProperties(runtimeIdentifier); var rv = DotNet.AssertBuildFailure(project_path, properties); var errors = BinLog.GetBuildLogErrors(rv.BinLogPath).ToArray(); Assert.AreEqual(1, errors.Length, "Error count"); Assert.AreEqual($"The RuntimeIdentifier '{runtimeIdentifier}' is invalid.", errors [0].Message, "Error message"); }
public void InvalidRuntimeIdentifiers(ApplePlatform platform, string runtimeIdentifiers) { var project = "MySimpleApp"; Configuration.IgnoreIfIgnoredPlatform(platform); var project_path = GetProjectPath(project, platform: platform); Clean(project_path); var properties = GetDefaultProperties(runtimeIdentifiers); var rv = DotNet.AssertBuildFailure(project_path, properties); var errors = BinLog.GetBuildLogErrors(rv.BinLogPath).ToArray(); Assert.AreEqual(1, errors.Length, "Error count"); Assert.AreEqual($"Building for all the runtime identifiers '{runtimeIdentifiers}' at the same time isn't possible, because they represent different platform variations.", errors [0].Message, "Error message"); }
[TestCase(ApplePlatform.MacCatalyst, "osx-x64")] // valid RID for another platform public void InvalidRuntimeIdentifier(ApplePlatform platform, string runtimeIdentifier) { var project = "MySimpleApp"; Configuration.IgnoreIfIgnoredPlatform(platform); var project_path = GetProjectPath(project, platform: platform); Clean(project_path); var properties = new Dictionary <string, string> (verbosity); properties ["RuntimeIdentifier"] = runtimeIdentifier; var rv = DotNet.AssertBuildFailure(project_path, properties); var errors = BinLog.GetBuildMessages(rv.BinLogPath).Where(v => v.Type == BuildLogEventType.Error).ToArray(); Assert.AreEqual(1, errors.Length, "Error count"); Assert.AreEqual($"The RuntimeIdentifier '{runtimeIdentifier}' is invalid.", errors [0].Message, "Error message"); }
public void DisableLinker(ApplePlatform platform, string runtimeIdentifiers) { var project = "MySimpleApp"; Configuration.IgnoreIfIgnoredPlatform(platform); var project_path = GetProjectPath(project, platform: platform); Clean(project_path); var properties = GetDefaultProperties(runtimeIdentifiers); properties ["PublishTrimmed"] = "false"; var rv = DotNet.AssertBuildFailure(project_path, properties); var errors = BinLog.GetBuildLogErrors(rv.BinLogPath).ToArray(); Assert.AreEqual(1, errors.Length, "Error count"); Assert.AreEqual($"{platform.AsString ()} projects must build with PublishTrimmed=true. Current value: false.", errors [0].Message, "Error message"); }