예제 #1
0
        public void BuildExtension(string hostAppName, string extensionName, string bundlePath, string platform, int expectedErrorCount = 0)
        {
            var mtouchPaths = SetupProjectPaths(hostAppName, "../", true, bundlePath);

            var proj = SetupProject(Engine, mtouchPaths ["project_csprojpath"]);

            AppBundlePath = mtouchPaths ["app_bundlepath"];
            string extensionPath = Path.Combine(AppBundlePath, "PlugIns", extensionName + ".appex");

            Engine.GlobalProperties.SetProperty("Platform", platform);

            RunTarget(proj, "Clean");
            Assert.IsFalse(Directory.Exists(AppBundlePath), "{1}: App bundle exists after cleanup: {0} ", AppBundlePath, bundlePath);

            proj = SetupProject(Engine, mtouchPaths.ProjectCSProjPath);
            RunTarget(proj, "Build", expectedErrorCount);

            if (expectedErrorCount > 0)
            {
                return;
            }

            Assert.IsTrue(Directory.Exists(AppBundlePath), "{1} App Bundle does not exist: {0} ", AppBundlePath, bundlePath);

            TestPList(AppBundlePath, new string[] { "CFBundleExecutable", "CFBundleVersion" });

            Assert.IsTrue(Directory.Exists(extensionPath), "Appex directory does not exist: {0} ", extensionPath);

            TestPList(extensionPath, new string[] { "CFBundleExecutable", "CFBundleVersion" });

            TestFilesExists(AppBundlePath, ExpectedAppFiles);
            TestFilesDoNotExist(AppBundlePath, UnexpectedAppFiles);

            var coreFiles = platform == "iPhone" ? CoreAppFiles : CoreAppFiles.Union(new string [] { hostAppName + ".exe", hostAppName }).ToArray();

            if (IsTVOS)
            {
                TestFilesExists(platform == "iPhone" ? Path.Combine(AppBundlePath, ".monotouch-64") : AppBundlePath, coreFiles);
            }
            else if (IsWatchOS)
            {
                coreFiles = platform == "iPhone" ? CoreAppFiles : CoreAppFiles.Union(new string [] { extensionName + ".dll", Path.GetFileNameWithoutExtension(extensionPath) }).ToArray();
                TestFilesExists(platform == "iPhone" ? Path.Combine(extensionPath, ".monotouch-32") : extensionPath, coreFiles);
            }
            else
            {
                TestFilesExists(platform == "iPhone" ? Path.Combine(AppBundlePath, ".monotouch-32") : AppBundlePath, coreFiles);
            }
        }
예제 #2
0
        public void BuildProject(string appName, string platform, int expectedErrorCount = 0)
        {
            var mtouchPaths = SetupProjectPaths(appName, "../", true, platform);

            var proj = SetupProject(Engine, mtouchPaths ["project_csprojpath"]);

            AppBundlePath = mtouchPaths ["app_bundlepath"];
            Engine.GlobalProperties.SetProperty("Platform", platform);

            RunTarget(proj, "Clean");
            Assert.IsFalse(Directory.Exists(AppBundlePath), "App bundle exists after cleanup: {0} ", AppBundlePath);

            proj = SetupProject(Engine, mtouchPaths.ProjectCSProjPath);
            RunTarget(proj, "Build", expectedErrorCount);

            if (expectedErrorCount > 0)
            {
                return;
            }

            Assert.IsTrue(Directory.Exists(AppBundlePath), "App Bundle does not exist: {0} ", AppBundlePath);

            TestFilesExists(AppBundlePath, ExpectedAppFiles);
            TestFilesDoNotExist(AppBundlePath, UnexpectedAppFiles);

            var coreFiles = platform == "iPhone" ? CoreAppFiles : CoreAppFiles.Union(new string [] { appName + ".exe", appName }).ToArray();

            if (IsTVOS)
            {
                TestFilesExists(platform == "iPhone" ? Path.Combine(AppBundlePath, ".monotouch-64") : AppBundlePath, coreFiles);
            }
            else
            {
                TestFilesExists(platform == "iPhone" ? Path.Combine(AppBundlePath, ".monotouch-32") : AppBundlePath, coreFiles);
            }
        }