コード例 #1
0
        public void ThirdPartyLibrary_WithIncorrectBitness_ShouldWarnOnRelease(bool sixtyFourBits)
        {
            MMPTests.RunMMPTest(tmpDir =>
            {
                var frameworkPath = FrameworkBuilder.CreateFatFramework(tmpDir);

                TI.UnifiedTestConfig test = CreateStripTestConfig(null, tmpDir, $" --native-reference=\"{frameworkPath}\"");

                // Should always skip lipo/warning in Debug
                string buildOutput = TI.TestUnifiedExecutable(test).BuildOutput;
                AssertNoLipoOrWarning(buildOutput, "Debug");

                // Should always lipo/warn in Release
                test.Release = true;
                buildOutput  = TI.TestUnifiedExecutable(test).BuildOutput;
                Assert.True(DidAnyLipoStrip(buildOutput), $"lipo did not run in release\n{buildOutput}");
                Assert.True(buildOutput.Contains("MM2108"), $"MM2108 not given in release\n{buildOutput}");
            });
        }
コード例 #2
0
        public void ThirdPartyLibrary_WithIncorrectBitness_ShouldWarnOnRelease(bool sixtyFourBits)
        {
            MMPTests.RunMMPTest(tmpDir =>
            {
                var frameworkPath = FrameworkBuilder.CreateFatFramework(tmpDir);

                TI.UnifiedTestConfig test = CreateStripTestConfig(null, tmpDir, $" --native-reference=\"{frameworkPath}\"");

                // Should always skip lipo/warning in Debug
                var testResult = TI.TestUnifiedExecutable(test);
                AssertNoLipoOrWarning(testResult.BuildResult, "Debug");

                // Should always lipo/warn in Release
                test.Release = true;
                testResult   = TI.TestUnifiedExecutable(test);
                Assert.True(DidAnyLipoStrip(testResult.BuildResult), $"lipo did not run in release");
                testResult.BuildResult.Messages.AssertError(2108, $"{frameworkPath} was stripped of architectures except x86_64 to comply with App Store restrictions. This could break existing codesigning signatures. Consider stripping the library with lipo or disabling with --optimize=-trim-architectures");
                // Assert.True (testResult.Contains ("MM2108"), $"MM2108 not given in release");
            });
        }
コード例 #3
0
        public void ShouldNotUnnecessarilyRebuildFinalProject(bool useProjectReference, bool framework)
        {
            MMPTests.RunMMPTest(tmpDir => {
                var projects = BindingProjectTests.GenerateTestProject(BindingProjectType.Modern, tmpDir);
                BindingProjectTests.SetNoEmbedding(projects.Item1);

                const string BuildString = "xcrun -sdk macosx clang";

                string frameworkPath = null;
                if (framework)
                {
                    frameworkPath             = FrameworkBuilder.CreateThinFramework(tmpDir);
                    projects.Item1.ItemGroup += NativeReferenceTests.CreateSingleNativeRef(Path.GetFullPath(frameworkPath), "Framework");
                }
                string appBuildLog = BindingProjectTests.SetupAndBuildLinkedTestProjects(projects.Item1, projects.Item2, tmpDir, useProjectReference, setupDefaultNativeReference: !framework).Item2;

                Assert.True(appBuildLog.Contains(BuildString), $"First build did not run mmp? {TI.PrintRedirectIfLong (appBuildLog)}");

                string projectPath = Path.Combine(tmpDir, "UnifiedExample.csproj");
                string mainPath    = Path.Combine(tmpDir, "Main.cs");

                // No change build should not
                string buildLog = TI.BuildProject(projectPath, true);
                Assert.False(buildLog.Contains(BuildString), $"Rebuild ran mmp again? {TI.PrintRedirectIfLong (buildLog)}");

                if (useProjectReference)
                {
                    // Touching the binding definition should
                    Touch(Path.Combine(tmpDir, "ApiDefinition.cs"));
                    buildLog = TI.BuildProject(projectPath, true);
                    Assert.True(buildLog.Contains(BuildString), $"Binding definition build did not run mmp again? {TI.PrintRedirectIfLong (buildLog)}");
                }
                else
                {
                    // Touching the binding assembly should
                    Touch(Path.Combine(tmpDir, "bin/Debug/MobileBinding.dll"));
                    buildLog = TI.BuildProject(projectPath, true);
                    Assert.True(buildLog.Contains(BuildString), $"Binding build did not run mmp again? {TI.PrintRedirectIfLong (buildLog)}");
                }
            });
        }