public void CleanShouldRemoveBundle() { MMPTests.RunMMPTest(tmpDir => { var projects = BindingProjectTests.GenerateTestProject(BindingProjectType.Modern, tmpDir); BindingProjectTests.SetNoEmbedding(projects.Item1); string libBuildLog = BindingProjectTests.SetupAndBuildBindingProject(projects.Item1, true); TI.CleanUnifiedProject(Path.Combine(tmpDir, projects.Item1.ProjectName)); Assert.False(Directory.Exists(Path.Combine(tmpDir, "bin/Debug/MobileBinding.resources")), "Resource bundle was not cleaned up"); }); }
public void DoesNotSupportLinkWith(BindingProjectType type) { MMPTests.RunMMPTest(tmpDir => { var projects = BindingProjectTests.GenerateTestProject(type, tmpDir); BindingProjectTests.SetNoEmbedding(projects.Item1); projects.Item1.LinkWithName = "SimpleClassDylib.dylib"; string libBuildLog = BindingProjectTests.SetupAndBuildBindingProject(projects.Item1, false, shouldFail: true); Assert.True(libBuildLog.Contains("Can't create a binding resource package unless there are native references in the binding project."), $"Did not fail as expected: {TI.PrintRedirectIfLong (libBuildLog)}"); }); }
public void DoesNotSupportLinkWith(BindingProjectType type) { MMPTests.RunMMPTest(tmpDir => { var projects = BindingProjectTests.GenerateTestProject(type, tmpDir); BindingProjectTests.SetNoEmbedding(projects.Item1); projects.Item1.LinkWithName = "SimpleClassDylib.dylib"; var buildResult = BindingProjectTests.SetupAndBuildBindingProject(projects.Item1, false, shouldFail: true); buildResult.Messages.AssertError(7068, "Can't create a binding resource package unless there are native references in the binding project.\n "); }); }
public void ShouldNotUnnecessarilyRebuildBindingProject(bool framework) { MMPTests.RunMMPTest(tmpDir => { var projects = BindingProjectTests.GenerateTestProject(BindingProjectType.Modern, tmpDir); BindingProjectTests.SetNoEmbedding(projects.Item1); string projectPath = Path.Combine(tmpDir, "MobileBinding.csproj"); string bindingFilePath = Path.Combine(tmpDir, "ApiDefinition.cs"); const string CreatePackageString = "Creating binding resource package"; // First build should create a package string frameworkPath = null; if (framework) { frameworkPath = FrameworkBuilder.CreateThinFramework(tmpDir); projects.Item1.ItemGroup += NativeReferenceTests.CreateSingleNativeRef(Path.GetFullPath(frameworkPath), "Framework"); } string libBuildLog = BindingProjectTests.SetupAndBuildBindingProject(projects.Item1, setupDefaultNativeReference: !framework); Assert.True(libBuildLog.Contains(CreatePackageString), $"First build did not create package? {TI.PrintRedirectIfLong (libBuildLog)}"); // No change build should not libBuildLog = TI.BuildProject(projectPath, true); Assert.False(libBuildLog.Contains(CreatePackageString), $"Rebuild build did create package? {TI.PrintRedirectIfLong (libBuildLog)}"); // Touching the binding project should Touch(projectPath); libBuildLog = TI.BuildProject(projectPath, true); Assert.True(libBuildLog.Contains(CreatePackageString), $"Binding Project build did not create package? {TI.PrintRedirectIfLong (libBuildLog)}"); // Touching the binding file should Touch(bindingFilePath); libBuildLog = TI.BuildProject(projectPath, true); Assert.True(libBuildLog.Contains(CreatePackageString), $"Binding File build did not create package? {TI.PrintRedirectIfLong (libBuildLog)}"); // No change build should not libBuildLog = TI.BuildProject(projectPath, true); Assert.False(libBuildLog.Contains(CreatePackageString), $"Second Rebuild build did create package? {TI.PrintRedirectIfLong (libBuildLog)}"); // Touching native library should Touch(framework ? frameworkPath + "/Foo" : NativeReferenceTests.SimpleDylibPath); libBuildLog = TI.BuildProject(projectPath, true); Assert.True(libBuildLog.Contains(CreatePackageString), $"Native Library build did not create package? {TI.PrintRedirectIfLong (libBuildLog)}"); }); }