Пример #1
0
        public override SolutionItemConfiguration CreateConfiguration(string name)
        {
            NMEProjectConfiguration conf = new NMEProjectConfiguration();

            conf.Name = name;
            return(conf);
        }
        public override void CopyFrom(ItemConfiguration configuration)
        {
            base.CopyFrom(configuration);

            NMEProjectConfiguration other = (NMEProjectConfiguration)configuration;

            mAdditionalArguments = other.mAdditionalArguments;
        }
 public static bool CanRun(NMEProject project, NMEProjectConfiguration configuration, ExecutionContext context)
 {
     ExecutionCommand cmd = CreateExecutionCommand (project, configuration);
     if (cmd == null)
     {
         return false;
     }
     return context.ExecutionHandler.CanExecute (cmd);
 }
		public static void Clean (NMEProject project, NMEProjectConfiguration configuration, IProgressMonitor monitor)
		{
			ProcessStartInfo info = new ProcessStartInfo ();
			
			info.FileName = "haxelib";
			info.Arguments = "run nme clean \"" + project.TargetNMMLFile + "\" " + configuration.Platform.ToLower () + " " + project.AdditionalArguments + " " + configuration.AdditionalArguments;
			info.UseShellExecute = false;
			info.RedirectStandardOutput = true;
			info.RedirectStandardError = true;
			info.WorkingDirectory = project.BaseDirectory;
			//info.WindowStyle = ProcessWindowStyle.Hidden;
			info.CreateNoWindow = true;
			
			using (Process process = Process.Start (info))
			{
				process.WaitForExit ();
			}
		}
		public static BuildResult Compile (NMEProject project, NMEProjectConfiguration configuration, IProgressMonitor monitor)
		{
			string args = "run nme build \"" + project.TargetNMMLFile + "\" " + configuration.Platform.ToLower ();
			
			if (configuration.DebugMode)
			{
				args += " -debug";
			}
			
			if (project.AdditionalArguments != "")
			{
				args += " " + project.AdditionalArguments;
			}
			
			if (configuration.AdditionalArguments != "")
			{
				args += " " + configuration.AdditionalArguments;
			}
			
			string error = "";
			int exitCode = DoCompilation ("haxelib", args, project.BaseDirectory, monitor, ref error);
			
			BuildResult result = ParseOutput (project, error);
			if (result.CompilerOutput.Trim ().Length != 0)
				monitor.Log.WriteLine (result.CompilerOutput);
			
			if (result.ErrorCount == 0 && exitCode != 0)
			{
				string errorMessage = File.ReadAllText (error);
				if (!string.IsNullOrEmpty (errorMessage))
				{
					result.AddError (errorMessage);
				}
				else
				{
					result.AddError ("Build failed. Go to \"Build Output\" for more information");
				}
			}
			
			FileService.DeleteFile (error);
			return result;
		}
        public static BuildResult Compile(NMEProject project, NMEProjectConfiguration configuration, IProgressMonitor monitor)
        {
            string args = "run nme build " + project.TargetNMMLFile + " " + configuration.Platform.ToLower ();

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

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

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

            string error = "";
            int exitCode = DoCompilation ("haxelib", args, project.BaseDirectory, monitor, ref error);

            BuildResult result = ParseOutput (project, error);
            if (result.CompilerOutput.Trim ().Length != 0)
                monitor.Log.WriteLine (result.CompilerOutput);

            if (result.ErrorCount == 0 && exitCode != 0)
            {
                if (!string.IsNullOrEmpty (error))
                    result.AddError (error);
                else
                    result.AddError ("The compiler appears to have crashed without any error output.");
            }

            FileService.DeleteFile (error);
            return result;
        }
Пример #7
0
        protected override bool OnGetCanExecute(ExecutionContext context, ConfigurationSelector configurationSelector)
        {
            NMEProjectConfiguration haxeConfig = (NMEProjectConfiguration)GetConfiguration(configurationSelector);

            return(NMECommandLineToolsManager.CanRun(this, haxeConfig, context));
        }
Пример #8
0
        protected override void DoExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configurationSelector)
        {
            NMEProjectConfiguration haxeConfig = (NMEProjectConfiguration)GetConfiguration(configurationSelector);

            NMECommandLineToolsManager.Run(this, haxeConfig, monitor, context);
        }
Пример #9
0
        protected override void DoClean(IProgressMonitor monitor, ConfigurationSelector configurationSelector)
        {
            NMEProjectConfiguration haxeConfig = (NMEProjectConfiguration)GetConfiguration(configurationSelector);

            NMECommandLineToolsManager.Clean(this, haxeConfig, monitor);
        }
Пример #10
0
        protected override BuildResult DoBuild(IProgressMonitor monitor, ConfigurationSelector configurationSelector)
        {
            NMEProjectConfiguration haxeConfig = (NMEProjectConfiguration)GetConfiguration(configurationSelector);

            return(NMECommandLineToolsManager.Compile(this, haxeConfig, monitor));
        }
		public static void Run (NMEProject project, NMEProjectConfiguration configuration, IProgressMonitor monitor, ExecutionContext context)
		{
			ExecutionCommand cmd = CreateExecutionCommand (project, configuration);

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

			AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor (monitor);

			try
			{
				if (!context.ExecutionHandler.CanExecute (cmd))
				{
					monitor.ReportError (String.Format ("Cannot execute '{0}'.", cmd), 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}'.", cmd), null);
			}
			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 string GetHXMLData (NMEProject project, NMEProjectConfiguration configuration)
		{
			ProcessStartInfo info = new ProcessStartInfo ();
			
			info.FileName = "haxelib";
			info.Arguments = "run nme update \"" + project.TargetNMMLFile + "\" " + configuration.Platform.ToLower () + " " + project.AdditionalArguments + " " + configuration.AdditionalArguments;
			info.UseShellExecute = false;
			info.RedirectStandardOutput = true;
			info.RedirectStandardError = true;
			info.WorkingDirectory = project.BaseDirectory;
			//info.WindowStyle = ProcessWindowStyle.Hidden;
			info.CreateNoWindow = true;
			
			using (Process process = Process.Start (info))
			{
				process.WaitForExit ();
			}
			
			info.Arguments = "run nme display \"" + project.TargetNMMLFile + "\" " + configuration.Platform.ToLower () + " " + project.AdditionalArguments + " " + configuration.AdditionalArguments;
			
			using (Process process = Process.Start (info))
			{
				string data = process.StandardOutput.ReadToEnd ();
				process.WaitForExit ();
				return data.Replace (Environment.NewLine, " ");
			}
		}
        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 ();
            }
        }
Пример #15
0
		public override SolutionItemConfiguration CreateConfiguration (string name)
		{
			NMEProjectConfiguration conf = new NMEProjectConfiguration ();
			conf.Name = name;
			return conf;
		}