public override IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
		{			
			PythonExecutionCommand cmd = (PythonExecutionCommand) command;
			
			string[] args = cmd.Configuration.Runtime.GetArguments (cmd.Configuration);
			string dir = Path.GetFullPath (cmd.Configuration.OutputDirectory);				
			
			NativeExecutionCommand ncmd = new NativeExecutionCommand (cmd.Configuration.Runtime.Path, string.Join (" ", args), dir, cmd.Configuration.EnvironmentVariables);
			return base.Execute (ncmd, console);
		}
		public override IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
		{
			DotNetExecutionCommand dotcmd = (DotNetExecutionCommand) command;
			
			string runtimeArgs = string.IsNullOrEmpty (dotcmd.RuntimeArguments) ? "--debug" : dotcmd.RuntimeArguments;
			
			string args = string.Format ("{2} \"{0}\" {1}", dotcmd.Command, dotcmd.Arguments, runtimeArgs);
			NativeExecutionCommand cmd = new NativeExecutionCommand (monoPath, args, dotcmd.WorkingDirectory, dotcmd.EnvironmentVariables);
			
			return base.Execute (cmd, console);
		}
Example #3
0
        public override IProcessAsyncOperation Execute(ExecutionCommand command, IConsole console)
        {
            DotNetExecutionCommand dotcmd = (DotNetExecutionCommand)command;

            string runtimeArgs = string.IsNullOrEmpty(dotcmd.RuntimeArguments) ? "--debug" : dotcmd.RuntimeArguments;

            string args = string.Format("{2} \"{0}\" {1}", dotcmd.Command, dotcmd.Arguments, runtimeArgs);
            NativeExecutionCommand cmd = new NativeExecutionCommand(monoPath, args, dotcmd.WorkingDirectory, dotcmd.EnvironmentVariables);

            return(base.Execute(cmd, console));
        }
		public override IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
		{
			DotNetExecutionCommand dotcmd = (DotNetExecutionCommand) command;
			
			string tempFile = Path.GetTempFileName ();
			string snapshotFile = profiler.GetSnapshotFileName (dotcmd.Command, tempFile);
			
			string args = string.Format ("--profile={2}:{3} --debug \"{0}\" {1}", dotcmd.Command, dotcmd.Arguments, profiler.Identifier, tempFile);
			NativeExecutionCommand cmd = new NativeExecutionCommand ("mono", args, dotcmd.WorkingDirectory, dotcmd.EnvironmentVariables);
			
			IProcessAsyncOperation pao = base.Execute (cmd, console);
			
			ProfilingService.ActiveProfiler = profiler;
			ProfilingContext profContext = new ProfilingContext (pao, snapshotFile);
			profiler.Start (profContext);
			return pao;
		}
Example #5
0
        internal static void ExecuteProject(DubProject prj,IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
        {
            var conf = prj.GetConfiguration(configuration) as DubProjectConfiguration;
            IConsole console;
            if (conf.ExternalConsole)
                console = context.ExternalConsoleFactory.CreateConsole(!conf.PauseConsoleOutput);
            else
                console = context.ConsoleFactory.CreateConsole(true);

            var operationMonitor = new AggregatedOperationMonitor(monitor);

            var sr = new StringBuilder("run");
            Instance.BuildCommonArgAppendix(sr, prj, configuration);

            try
            {
                var cmd = new NativeExecutionCommand(Instance.DubExecutable, sr.ToString(), prj.BaseDirectory.ToString());
                if (!context.ExecutionHandler.CanExecute(cmd))
                {
                    monitor.ReportError("Cannot execute \""  + "\". The selected execution mode is not supported for Dub projects.", null);
                    return;
                }

                var op = context.ExecutionHandler.Execute(cmd, console);

                operationMonitor.AddOperation(op);
                op.WaitForCompleted();

                monitor.Log.WriteLine(Instance.DubExecutable+" exited with code: {0}", op.ExitCode);

            }
            catch (Exception ex)
            {
                monitor.ReportError("Cannot execute \"" + sr.ToString() + "\"", ex);
            }
            finally
            {
                operationMonitor.Dispose();
                console.Dispose();
            }
        }
		public ProcessAsyncOperation Execute (ExecutionCommand command, OperationConsole console)
		{
			var cmd = (AspNetExecutionCommand) command;
			var xspPath = GetXspPath (cmd);

			var evars = new Dictionary<string, string>(cmd.EnvironmentVariables);

			foreach (var v in cmd.TargetRuntime.GetToolsExecutionEnvironment (cmd.TargetFramework).Variables)
			{
				if (!evars.ContainsKey (v.Key))
					evars.Add (v.Key, v.Value);
			}

			//HACK: work around Mono trying to create registry in non-writable location
			if (cmd.TargetRuntime is MonoTargetRuntime && !Platform.IsWindows) {
				evars ["MONO_REGISTRY_PATH"] = UserProfile.Current.TempDir.Combine ("aspnet-registry");
			}

			//if it's a script, use a native execution handler
			if (xspPath.Extension != ".exe") {
				//set mono debug mode if project's in debug mode
				if (cmd.DebugMode) {
					evars ["MONO_OPTIONS"] = "--debug";
				}
				
				var ncmd = new NativeExecutionCommand (
					xspPath, cmd.XspParameters.GetXspParameters () + " --nonstop",
					cmd.BaseDirectory, evars);
				
				return Runtime.ProcessService.GetDefaultExecutionHandler (ncmd).Execute (ncmd, console);
			}

			// Set DEVPATH when running on Windows (notice that this has no effect unless
			// <developmentMode developerInstallation="true" /> is set in xsp2.exe.config

			if (cmd.TargetRuntime is MsNetTargetRuntime)
				evars["DEVPATH"] = Path.GetDirectoryName (xspPath);
			
			var netCmd = new DotNetExecutionCommand (
				xspPath, cmd.XspParameters.GetXspParameters () + " --nonstop",
				cmd.BaseDirectory, evars);
			netCmd.DebugMode = cmd.DebugMode;
			
			return cmd.TargetRuntime.GetExecutionHandler ().Execute (netCmd, console);
		}
        private static ExecutionCommand CreateExecutionCommand(HaxeProject project, HaxeProjectConfiguration configuration)
        {
            string hxmlPath = Path.GetFullPath (project.TargetHXMLFile);

            if (!File.Exists (hxmlPath))
            {
                hxmlPath = Path.Combine (project.BaseDirectory, project.TargetHXMLFile);
            }

            string hxml = File.ReadAllText (hxmlPath);
            hxml = hxml.Replace (Environment.NewLine, " ");
            string[] hxmlArgs = hxml.Split (' ');

            List<string> platforms = new List<string> ();
            List<string> platformOutputs = new List<string> ();

            bool addNext = false;
            bool nextIsMain = false;
            string main = "";

            foreach (string hxmlArg in hxmlArgs)
            {
                if (addNext)
                {
                    if (!hxmlArg.StartsWith ("-"))
                    {
                        if (nextIsMain)
                        {
                            main = hxmlArg;
                            nextIsMain = false;
                        }
                        else
                        {
                            platformOutputs.Add (hxmlArg);
                        }
                    }
                    else
                    {
                        if (!nextIsMain)
                        {
                            platforms.RemoveAt (platforms.Count - 1);
                        }
                    }
                }

                addNext = true;

                switch (hxmlArg)
                {
                    case "-cpp":
                        platforms.Add ("cpp");
                        break;

                    case "-swf":
                    case "-swf9":
                        platforms.Add ("flash");
                        break;

                    case "-js":
                        platforms.Add ("js");
                        break;

                    case "-neko":
                        platforms.Add ("neko");
                        break;

                    case "-php":
                        platforms.Add ("php");
                        break;

                    case "-main":
                        nextIsMain = true;
                        break;

                    default:
                        addNext = false;
                        break;
                }
            }

            int i = 0;

            //for (int i = 0; i < platforms.Count; i++)
            //{
                string platform = platforms[i];
                string output = platformOutputs[i];

                if (platform == "cpp" || platform == "neko")
                {
                    if (platform == "cpp")
                    {
                        output = Path.Combine (output, main);
                        if (configuration.DebugMode)
                        {
                            output += "-debug";
                        }
                    }

                    if (!File.Exists (Path.GetFullPath (output)))
                    {
                        output = Path.Combine (project.BaseDirectory, output);
                    }

                    string exe = "";
                    string args = "";

                    if (platform == "cpp")
                    {
                        exe = output;
                    }
                    else
                    {
                        exe = "neko";
                        args = "\"" + output + "\"";
                    }

                    NativeExecutionCommand cmd = new NativeExecutionCommand (exe);
                    cmd.Arguments = args;
                    cmd.WorkingDirectory = Path.GetDirectoryName (output);

                    if (configuration.DebugMode)
                    {
                        cmd.EnvironmentVariables.Add ("HXCPP_DEBUG_HOST", "gdb");
                        cmd.EnvironmentVariables.Add ("HXCPP_DEBUG", "1");
                    }
                    //cmd.WorkingDirectory = project.BaseDirectory.FullPath;

                    //MonoDevelop.Ide.MessageService.ShowMessage (cmd.Command);
                    //MonoDevelop.Ide.MessageService.ShowMessage (cmd.Arguments);
                    //MonoDevelop.Ide.MessageService.ShowMessage (cmd.WorkingDirectory);

                    return cmd;
                }
                else if (platform == "flash" || platform == "js")
                {
                    if (!File.Exists (Path.GetFullPath (output)))
                    {
                        output = Path.Combine (project.BaseDirectory, output);
                    }

                    if (platform == "js")
                    {
                        output = Path.Combine (Path.GetDirectoryName (output), "index.html");
                    }

                    //string target = output;

                    switch (Environment.OSVersion.Platform)
                    {
                        case PlatformID.MacOSX:
                            //target = "open \"" + output + "\"";
                            break;

                        case PlatformID.Unix:
                            //target = "xdg-open \"" + output + "\"";
                            break;
                    }

                    ProcessExecutionCommand cmd = new ProcessExecutionCommand ();
                    cmd.Command = output;
                    return cmd;
                }
            //}

            return null;
        }
		public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
		{
			var cmd = (AspNetExecutionCommand) command;
			var xspName = GetXspName (cmd);
			var xspPath = GetXspPath (cmd, xspName);
			
			if (xspPath.IsNullOrEmpty || !File.Exists (xspPath))
				throw new UserException (string.Format ("The \"{0}\" web server cannot be started. Please ensure that it is installed.", xspName), null);
		
			//if it's a script, use a native execution handler
			if (xspPath.Extension != ".exe") {
				//set mono debug mode if project's in debug mode
				var envVars = cmd.TargetRuntime.GetToolsExecutionEnvironment (cmd.TargetFramework).Variables; 
				if (cmd.DebugMode) {
					envVars = new Dictionary<string, string> (envVars);
					envVars ["MONO_OPTIONS"] = "--debug";
				}
				
				var ncmd = new NativeExecutionCommand (
					xspPath, cmd.XspParameters.GetXspParameters () + " --nonstop",
					cmd.BaseDirectory, envVars);
				
				return Runtime.ProcessService.GetDefaultExecutionHandler (ncmd).Execute (ncmd, console);
			}

			// Set DEVPATH when running on Windows (notice that this has no effect unless
			// <developmentMode developerInstallation="true" /> is set in xsp2.exe.config

			var evars = cmd.TargetRuntime.GetToolsExecutionEnvironment (cmd.TargetFramework).Variables;
			if (cmd.TargetRuntime is MsNetTargetRuntime)
				evars["DEVPATH"] = Path.GetDirectoryName (xspPath);
			
			var netCmd = new DotNetExecutionCommand (
				xspPath, cmd.XspParameters.GetXspParameters () + " --nonstop",
				cmd.BaseDirectory, evars);
			netCmd.DebugMode = cmd.DebugMode;
			
			return cmd.TargetRuntime.GetExecutionHandler ().Execute (netCmd, console);
		}
Example #9
0
 protected virtual ExecutionCommand CreateExecutionCommand(DProjectConfiguration conf)
 {
     var app = GetOutputFileName(conf.Selector);
     var cmd = new NativeExecutionCommand (app);
     cmd.Arguments = conf.CommandLineParameters;
     cmd.WorkingDirectory = conf.OutputDirectory.ToAbsolute(BaseDirectory);
     cmd.EnvironmentVariables = conf.EnvironmentVariables;
     return cmd;
 }
Example #10
0
		protected virtual ExecutionCommand CreateExecutionCommand (CProjectConfiguration conf)
		{
			string app = Path.Combine (conf.OutputDirectory, conf.Output);
			NativeExecutionCommand cmd = new NativeExecutionCommand (app);
			cmd.Arguments = conf.CommandLineParameters;
			cmd.WorkingDirectory = Path.GetFullPath (conf.OutputDirectory);
			cmd.EnvironmentVariables = conf.EnvironmentVariables;
			return cmd;
		}
Example #11
0
        protected override void DoExecute(IProgressMonitor monitor,
		                                   ExecutionContext context,
		                                   ConfigurationSelector configuration)
        {
            RubyProjectConfiguration conf = (RubyProjectConfiguration)GetConfiguration (configuration);
            bool pause = conf.PauseConsoleOutput;
            IConsole console = (conf.ExternalConsole? context.ExternalConsoleFactory: context.ConsoleFactory).CreateConsole (!pause);
            List<string> loadPaths = new List<string> ();
            loadPaths.Add (BaseDirectory.FullPath);
            foreach (object path in conf.LoadPaths) {
                if (!string.IsNullOrEmpty ((string)path)){ loadPaths.Add ((string)path); }
            }

            ExecutionCommand cmd = new NativeExecutionCommand (RubyLanguageBinding.RubyInterpreter, conf.MainFile, BaseDirectory.FullPath,
                                                               new Dictionary<string,string>(){{"RUBYLIB", string.Join (Path.DirectorySeparatorChar.ToString(), loadPaths.ToArray ()) }});

            monitor.Log.WriteLine ("Running {0} {1}", RubyLanguageBinding.RubyInterpreter, conf.MainFile);

            AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor (monitor);

            try {
                if (!context.ExecutionHandler.CanExecute (cmd)) {
                    monitor.ReportError (string.Format ("Cannot execute {0}.", conf.MainFile), null);
                    return;
                }

                IProcessAsyncOperation op = context.ExecutionHandler.Execute (cmd, console);

                operationMonitor.AddOperation (op);
                op.WaitForCompleted ();

                monitor.Log.WriteLine ("The operation exited with code: {0}", op.ExitCode);
            } catch (Exception ex) {
                monitor.ReportError (string.Format ("Cannot execute {0}.", conf.MainFile), ex);
            } finally {
                operationMonitor.Dispose ();
                console.Dispose ();
            }
        }
		private static ExecutionCommand CreateExecutionCommand (NMEProject project, NMEProjectConfiguration configuration)
		{
			string exe = "haxelib";
			string args = "run nme run \"" + project.TargetNMMLFile + "\" " + configuration.Platform.ToLower ();
			
			if (configuration.DebugMode)
			{
				args += " -debug";
			}
			
			if (project.AdditionalArguments != "")
			{
				args += " " + project.AdditionalArguments;
			}
			
			if (configuration.AdditionalArguments != "")
			{
				args += " " + configuration.AdditionalArguments;
			}

			NativeExecutionCommand cmd = new NativeExecutionCommand (exe);
			cmd.Arguments = args;
			cmd.WorkingDirectory = project.BaseDirectory.FullPath;
			
			return cmd;
		}
        public static void Run(NMEProject project, NMEProjectConfiguration configuration, IProgressMonitor monitor, ExecutionContext context)
        {
            string exe = "haxelib";
            string args = "run nme run " + project.TargetNMMLFile + " " + configuration.Platform.ToLower ();

            if (configuration.DebugMode)
            {
                args += " -debug";
            }

            if (project.AdditionalArguments != "")
            {
                args += " " + project.AdditionalArguments;
            }

            if (configuration.AdditionalArguments != "")
            {
                args += " " + configuration.AdditionalArguments;
            }

            IConsole console;
            if (configuration.ExternalConsole)
                console = context.ExternalConsoleFactory.CreateConsole (false);
            else
                console = context.ConsoleFactory.CreateConsole (false);

            AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor (monitor);

            try
            {
                NativeExecutionCommand cmd = new NativeExecutionCommand (exe);
                cmd.Arguments = args;
                cmd.WorkingDirectory = project.BaseDirectory.FullPath;

                if (!context.ExecutionHandler.CanExecute (cmd))
                {
                    monitor.ReportError (String.Format ("Cannot execute '{0} {1}'.", exe, args), null);
                    return;
                }

                IProcessAsyncOperation operation = context.ExecutionHandler.Execute (cmd, console);

                operationMonitor.AddOperation (operation);
                operation.WaitForCompleted ();

                monitor.Log.WriteLine ("Player exited with code {0}.", operation.ExitCode);
            }
            catch (Exception)
            {
                monitor.ReportError (String.Format ("Error while executing '{0} {1}'.", exe, args), null);
            }
            finally
            {
                operationMonitor.Dispose ();
                console.Dispose ();
            }
        }
Example #14
0
        void DoExecuteWithExe(IProgressMonitor monitor, ExecutionContext context, string exe, HaxeProjectConfiguration configuration)
        {
            monitor.Log.WriteLine("Running project using '{0}' ...", exe);

            if (string.IsNullOrEmpty(exe)) {
                monitor.ReportError(String.Format("No custom player or browser configured."), null);
                return;
            }

            string[] parts = exe.Split(' ');
            string args = "file://"+Path.GetFullPath(Path.Combine(configuration.OutputDirectory, configuration.OutputFileName));
            if (parts.Length > 1)
                args = string.Join(" ", parts, 1, parts.Length-1) + " " + args;
            exe = parts[0];

            IConsole console;
            if (configuration.ExternalConsole)
                console = context.ExternalConsoleFactory.CreateConsole(false);
            else
                console = context.ConsoleFactory.CreateConsole(false);

            AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor(monitor);

            try {
                NativeExecutionCommand cmd = new NativeExecutionCommand(exe);
                cmd.Arguments = args;
                cmd.WorkingDirectory = Path.GetFullPath(configuration.OutputDirectory);

                if (!context.ExecutionHandler.CanExecute(cmd)) {
                    monitor.ReportError(String.Format("Cannot execute '{0} {1}'.", exe, args), null);
                    return;
                }

                IProcessAsyncOperation operation = context.ExecutionHandler.Execute(cmd, console);

                operationMonitor.AddOperation(operation);
                operation.WaitForCompleted();

                monitor.Log.WriteLine("Player exited with code {0}.", operation.ExitCode);
            }
            catch (Exception) {
                    monitor.ReportError(String.Format("Error while executing '{0} {1}'.", exe, args), null);
            }
            finally {
                operationMonitor.Dispose();
                console.Dispose();
            }
        }
Example #15
0
		ExecutionCommand CreateExecutionCommand (ValaProjectConfiguration conf)
		{
			NativeExecutionCommand cmd = new NativeExecutionCommand ();
			cmd.Command = Path.Combine (conf.OutputDirectory, conf.Output);
			cmd.Arguments = conf.CommandLineParameters;
			cmd.WorkingDirectory = Path.GetFullPath (conf.OutputDirectory);
			return cmd;
		}