Пример #1
0
        private string[] BuildNmeCommand(string[] extraClasspaths, string output, string target, bool noTrace, string extraArgs)
        {
            List <String> pr = new List <String>();

            string builder = HaxeProject.GetBuilder(output);

            if (builder == null)
            {
                builder = "openfl";
            }

            pr.Add("run " + builder + " build");
            pr.Add(Quote(output));
            pr.Add(target);
            if (!noTrace)
            {
                pr.Add("-debug");
                if (target.StartsWith("flash"))
                {
                    pr.Add("-Dfdb");
                }
            }
            if (extraArgs != null)
            {
                pr.Add(extraArgs);
            }

            return(pr.ToArray());
        }
Пример #2
0
        private static void UpdateProject()
        {
            string haxelib = GetHaxelib(hxproj);

            if (haxelib == "haxelib")
            {
                TraceManager.AddAsync("Haxelib not found", -3);
                return;
            }

            string builder = HaxeProject.GetBuilder(hxproj);

            if (builder == null)
            {
                TraceManager.AddAsync("Project config not found:\n" + hxproj.OutputPathAbsolute, -3);
                return;
            }

            string config = hxproj.TargetBuild;

            if (String.IsNullOrEmpty(config))
            {
                config = "flash";
            }

            ProcessStartInfo pi = new ProcessStartInfo();

            pi.FileName               = haxelib;
            pi.Arguments              = "run " + builder + " display \"" + hxproj.GetRelativePath(nmmlPath) + "\" " + config;
            pi.RedirectStandardError  = true;
            pi.RedirectStandardOutput = true;
            pi.UseShellExecute        = false;
            pi.CreateNoWindow         = true;
            pi.WorkingDirectory       = Path.GetDirectoryName(hxproj.ProjectPath);
            pi.WindowStyle            = ProcessWindowStyle.Hidden;
            Process p = Process.Start(pi);

            p.WaitForExit(5000);

            string hxml = p.StandardOutput.ReadToEnd();
            string err  = p.StandardError.ReadToEnd();

            p.Close();

            if (string.IsNullOrEmpty(hxml) || (!string.IsNullOrEmpty(err) && err.Trim().Length > 0))
            {
                if (string.IsNullOrEmpty(err))
                {
                    err = "Haxelib error: no response";
                }
                TraceManager.AddAsync(err, -3);
                hxproj.RawHXML = null;
            }
            else
            {
                hxproj.RawHXML = Regex.Split(hxml, "[\r\n]+");
            }
        }
Пример #3
0
        static public void Clean(IProject project)
        {
            if (!(project is HaxeProject))
            {
                return;
            }
            HaxeProject hxproj = project as HaxeProject;

            if (hxproj.MovieOptions.Platform != HaxeMovieOptions.NME_PLATFORM)
            {
                return;
            }

            string builder = HaxeProject.GetBuilder(hxproj);

            if (builder == null)
            {
                return;
            }

            string haxelib = GetHaxelib(hxproj);
            string config  = hxproj.TargetBuild;

            if (String.IsNullOrEmpty(config))
            {
                config = "flash";
            }

            ProcessStartInfo pi = new ProcessStartInfo();

            pi.FileName         = haxelib;
            pi.Arguments        = " run " + builder + " clean \"" + hxproj.OutputPathAbsolute + "\" " + config;
            pi.UseShellExecute  = false;
            pi.CreateNoWindow   = true;
            pi.WorkingDirectory = Path.GetDirectoryName(hxproj.ProjectPath);
            pi.WindowStyle      = ProcessWindowStyle.Hidden;
            Process p = Process.Start(pi);

            p.WaitForExit(5000);
            p.Close();
        }
Пример #4
0
        /// <summary>
        /// Run NME project (after build)
        /// </summary>
        /// <param name="command">Project's custom run command</param>
        /// <returns>Execution handled</returns>
        static public bool Run(string command)
        {
            if (!string.IsNullOrEmpty(command)) // project has custom run command
            {
                return(false);
            }

            HaxeProject project = PluginBase.CurrentProject as HaxeProject;

            if (project == null || project.OutputType != OutputType.Application)
            {
                return(false);
            }

            string builder = HaxeProject.GetBuilder(project);

            if (builder == null)
            {
                return(true);
            }

            string config = project.TargetBuild;

            if (String.IsNullOrEmpty(config))
            {
                config = "flash";
            }
            else if (config.IndexOf("android") >= 0)
            {
                CheckADB();
            }

            if (project.TraceEnabled)
            {
                config += " -debug -Dfdb";
            }
            //if (config.StartsWith("flash") && config.IndexOf("-DSWF_PLAYER") < 0)
            //    config += GetSwfPlayer();

            string args    = "run " + builder + " run \"" + project.OutputPathAbsolute + "\" " + config;
            string haxelib = GetHaxelib(project);

            if (config.StartsWith("html5") && ProjectManager.Actions.Webserver.Enabled && project.RawHXML != null) // webserver
            {
                foreach (string line in project.RawHXML)
                {
                    if (line.StartsWith("-js "))
                    {
                        string path = line.Substring(4);
                        path = path.Substring(0, path.LastIndexOf("/"));
                        ProjectManager.Actions.Webserver.StartServer(project.GetAbsolutePath(path));
                        return(true);
                    }
                }
            }

            TraceManager.Add("haxelib " + args);

            if (config.StartsWith("flash") || config.StartsWith("html5")) // no capture
            {
                if (config.StartsWith("flash") && project.TraceEnabled)   // debugger
                {
                    DataEvent de = new DataEvent(EventType.Command, "AS3Context.StartProfiler", null);
                    EventManager.DispatchEvent(project, de);
                    de = new DataEvent(EventType.Command, "AS3Context.StartDebugger", null);
                    EventManager.DispatchEvent(project, de);
                }

                var infos = new ProcessStartInfo(haxelib, args);
                infos.WorkingDirectory = project.Directory;
                infos.WindowStyle      = ProcessWindowStyle.Hidden;
                Process.Start(infos);
            }
            else
            {
                string oldWD = PluginBase.MainForm.WorkingDirectory;
                PluginBase.MainForm.WorkingDirectory = project.Directory;
                PluginBase.MainForm.CallCommand("RunProcessCaptured", haxelib + ";" + args);
                PluginBase.MainForm.WorkingDirectory = oldWD;
            }
            return(true);
        }