Esempio n. 1
0
        public static string GenerateYuzuDeserializersForApp()
        {
            AssetCooker.CookForActivePlatform();
            if (!BuildGame())
            {
                return("Can not BuildGame");
            }

            var builder = new SolutionBuilder(
                The.Workspace.ActivePlatform, The.Workspace.CustomSolution);
            int exitCode = builder.Run("--GenerateYuzuDeserializers");

            if (exitCode != 0)
            {
                return($"Application terminated with exit code {exitCode}");
            }
            string app      = builder.GetApplicationPath();
            string assembly = Path.Combine(Path.GetDirectoryName(app), "Serializer.dll");

            if (!File.Exists(assembly))
            {
                Console.WriteLine("{0} doesn't exist", assembly);
                Console.WriteLine(@"Ensure your Application.cs contains following code:
	if (Array.IndexOf(args, ""--GenerateYuzuDeserializers"") >= 0) {
		Lime.Serialization.GenerateDeserializers(""OceanDeserializers.cs"", ""OceanDeserializers"", GetSerializationTypes());
		return;
	}"    );
                return(string.Empty);
            }
            return(null);
            // TODO: write location of generated file
        }
Esempio n. 2
0
        public static bool CleanupGame()
        {
            DeleteAllBundlesInTopDirectory();
            DeleteAllBundlesReferredInCookingRules();

            var builder = new SolutionBuilder(The.Workspace.ActivePlatform, The.Workspace.CustomSolution);

            if (!builder.Clean())
            {
                Console.WriteLine("CLEANUP FAILED");
                return(false);
            }
            return(true);
        }
Esempio n. 3
0
        public static string UpdateXCodeProjectAction()
        {
            var target = The.UI.GetActiveTarget();

            if (target.Platform != TargetPlatform.iOS)
            {
                UserInterface.Instance.ExitWithErrorIfPossible();
                return("Error updating XCode project: active target must target iOS platform.");
            }
            if (The.Workspace.ProjectJson.GetValue <bool>("XCodeProject/DoSvnUpdate"))
            {
                Subversion.Update(GetXCodeProjectFolder());
            }
            AssetCooker.CookForTarget(
                target,
                new [] { CookingRulesBuilder.MainBundleName }
                );
            var solutionPath = The.Workspace.GetSolutionFilePath(TargetPlatform.iOS);
            var builder      = new SolutionBuilder(TargetPlatform.iOS, solutionPath);
            var output       = new StringBuilder();

            builder.Clean();
            if (builder.Build(output))
            {
                The.UI.ScrollLogToEnd();
                string allText = output.ToString();
                var    appPath = GetGeneratedAppPath(allText);
                foreach (var line in allText.Split('\n'))
                {
                    if (line.Contains("/bin/mtouch"))
                    {
                        var mtouch = line;
                        GenerateUnsignedBinary(target, mtouch);
                        var dstPath = GetXCodeProjectDataFolder();
                        CopyContent(appPath, dstPath);
                        CopyDSYM(appPath, Path.GetDirectoryName(dstPath));
                    }
                }
            }
            else
            {
                UserInterface.Instance.ExitWithErrorIfPossible();
                return("Build system has returned error");
            }
            if (The.Workspace.ProjectJson.GetValue <bool>("XCodeProject/DoSvnCommit"))
            {
                Subversion.Commit(GetXCodeProjectFolder(), "");
            }
            return(null);
        }
Esempio n. 4
0
        public static bool CleanupGame(Target target)
        {
            DeleteAllBundlesInTopDirectory(target);
            DeleteAllBundlesReferredInCookingRules(target);

            var builder = new SolutionBuilder(target.Platform, target.ProjectPath);

            if (!builder.Clean())
            {
                Console.WriteLine("CLEANUP FAILED");
                return(false);
            }
            return(true);
        }
Esempio n. 5
0
        public static bool RunGame(TargetPlatform platform, string customSolution = null)
        {
            var    builder       = new SolutionBuilder(platform, customSolution);
            string arguments     = PluginLoader.GetCommandLineArguments();
            string passArguments = Toolbox.GetCommandLineArg(ConsoleCommandPassArguments);
            int    exitCode      = builder.Run(string.Join(" ", arguments, passArguments));

            if (exitCode != 0)
            {
                Console.WriteLine("Application terminated with exit code {0}", exitCode);
                return(false);
            }
            return(true);
        }
Esempio n. 6
0
        public static bool BuildGame(Target target, string configuration)
        {
            var builder = new SolutionBuilder(target.Platform, target.ProjectPath, configuration);

            if (target.CleanBeforeBuild == true)
            {
                builder.Clean();
            }
            if (!builder.Build())
            {
                UserInterface.Instance.ExitWithErrorIfPossible();
                return(false);
            }
            return(true);
        }
Esempio n. 7
0
        public static bool RunGame(Target target)
        {
            var    builder   = new SolutionBuilder(target);
            string arguments = string.Join(" ",
                                           PluginLoader.GetCommandLineArguments(),
                                           Toolbox.GetCommandLineArg(ConsoleCommandPassArguments));
            int exitCode = builder.Run(arguments);

            if (exitCode != 0)
            {
                Console.WriteLine("Application terminated with exit code {0}", exitCode);
                return(false);
            }
            return(true);
        }
Esempio n. 8
0
        public static bool BuildGame(Target target)
        {
            var builder = new SolutionBuilder(target);

            if (target.CleanBeforeBuild == true)
            {
                builder.Clean();
            }
            if (!builder.Build())
            {
                UserInterface.Instance.ExitWithErrorIfPossible();
                return(false);
            }
            return(true);
        }
Esempio n. 9
0
        public static string RunTangerine()
        {
            const string projectName      = "Tangerine";
            var          projectDirectory = Path.Combine(Toolbox.CalcCitrusDirectory(), projectName);

#if WIN
            var solutionPath = Path.Combine(projectDirectory, projectName + ".Win.sln");
            MSBuild.TryGetMSBuildPath(out var msbuildPath);
            Nuget.Restore(solutionPath, msbuildPath);
            var solutionBuilder = new SolutionBuilder(
                TargetPlatform.Win,
                solutionPath,
                BuildConfiguration.Release);
#elif MAC
            var solutionPath = Path.Combine(projectDirectory, projectName + ".Win.sln");
            Nuget.Restore(solutionPath);
            var solutionBuilder = new SolutionBuilder(
                TargetPlatform.Mac,
                solutionPath,
                BuildConfiguration.Debug);                 // RELEASE requires code signing, use debug for a while.
#endif
            if (!solutionBuilder.Build())
            {
                return("Build system has returned error");
            }

            var p = new System.Diagnostics.Process();
#if WIN
            p.StartInfo.FileName = Path.Combine(
                projectDirectory,
                "Tangerine",
                "bin",
                BuildConfiguration.Release,
                "Tangerine.exe");
#elif MAC
            p.StartInfo.FileName = Path.Combine(
                projectDirectory,
                "Tangerine",
                "bin",
                BuildConfiguration.Debug,
                "Tangerine.app/Contents/MacOS/Tangerine");
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.EnvironmentVariables.Clear();
            p.StartInfo.EnvironmentVariables.Add("PATH", "/usr/bin");
#endif
            p.Start();
            return(null);
        }
Esempio n. 10
0
        public static bool BuildGame(
            TargetPlatform platform, string solutionPath, string configuration)
        {
            var builder = new SolutionBuilder(platform, solutionPath, configuration);

            if (The.Workspace.CleanBeforeBuild)
            {
                builder.Clean();
            }
            if (!builder.Build())
            {
                UserInterface.Instance.ExitWithErrorIfPossible();
                return(false);
            }
            return(true);
        }
Esempio n. 11
0
        public static string UpdateXCodeProjectAction()
        {
            if (The.Workspace.ProjectJson.GetValue <bool>("XCodeProject/DoSvnUpdate"))
            {
                Subversion.Update(GetXCodeProjectFolder());
            }
            AssetCooker.Cook(TargetPlatform.iOS);
            var builder = new Orange.SolutionBuilder(TargetPlatform.iOS);
            var output  = new StringBuilder();

            builder.Clean();
            if (builder.Build(output))
            {
                The.UI.ScrollLogToEnd();
                string allText = output.ToString();
                foreach (var line in allText.Split('\n'))
                {
                    if (line.Contains("/bin/mtouch"))
                    {
                        var mtouch = line;
                        GenerateUnsignedBinary(mtouch);
                        var appPath = GetGeneratedAppPath(mtouch);
                        var dstPath = GetXCodeProjectDataFolder();
                        CopyContent(appPath, dstPath);
                        CopyDSYM(appPath, Path.GetDirectoryName(dstPath));
                    }
                }
            }
            else
            {
                UserInterface.Instance.ExitWithErrorIfPossible();
                return("Build system has returned error");
            }
            if (The.Workspace.ProjectJson.GetValue <bool>("XCodeProject/DoSvnCommit"))
            {
                Subversion.Commit(GetXCodeProjectFolder(), "");
            }
            return(null);
        }
Esempio n. 12
0
        public static string GenerateYuzuDeserializersForApp()
        {
            AssetCooker.CookForActivePlatform();
#if WIN
            if (!BuildGame(Orange.TargetPlatform.Win))
            {
#elif MAC
            if (!BuildGame(Orange.TargetPlatform.Mac))
            {
#endif
                return("Can not BuildGame");
            }
#if WIN
            var builder = new SolutionBuilder(TargetPlatform.Win);
#elif MAC
            var builder = new SolutionBuilder(TargetPlatform.Mac);
#endif
            int exitCode = builder.Run("--GenerateYuzuDeserializers");
            if (exitCode != 0)
            {
                return($"Application terminated with exit code {exitCode}");
            }
            string app      = builder.GetApplicationPath();
            string dir      = System.IO.Path.GetDirectoryName(app);
            string assembly = System.IO.Path.Combine(dir, "Serializer.dll");
            if (!System.IO.File.Exists(assembly))
            {
                Console.WriteLine("{0} doesn't exist", assembly);
                Console.WriteLine(@"Ensure your Application.cs contains following code:
	if (Array.IndexOf(args, ""--GenerateYuzuDeserializers"") >= 0) {
		Lime.Serialization.GenerateDeserializers(""OceanDeserializers.cs"", ""OceanDeserializers"", GetSerializationTypes());
		return;
	}"    );
                return("");
            }
            return(null);
            // TODO: write location of generated file
        }
    }