public override SolutionItemConfiguration CreateConfiguration(string name) { OpenFLProjectConfiguration conf = new OpenFLProjectConfiguration(); conf.Name = name; return(conf); }
public override void CopyFrom(ItemConfiguration configuration) { base.CopyFrom(configuration); OpenFLProjectConfiguration other = (OpenFLProjectConfiguration)configuration; mAdditionalArguments = other.mAdditionalArguments; }
public static bool CanRun(OpenFLProject project, OpenFLProjectConfiguration configuration, ExecutionContext context) { ExecutionCommand cmd = (NativeExecutionCommand)CreateExecutionCommand (project, configuration); if (cmd == null) { return false; } return context.ExecutionHandler.CanExecute (cmd); }
public static void Clean(OpenFLProject project, OpenFLProjectConfiguration configuration, IProgressMonitor monitor) { ProcessStartInfo info = new ProcessStartInfo (); info.FileName = "haxe"; info.Arguments = " --run tools.haxelib.Main run openfl clean \"" + project.TargetProjectXMLFile + "\" " + 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(OpenFLProject project, OpenFLProjectConfiguration configuration, IProgressMonitor monitor) { string args = " --run tools.haxelib.Main run openfl build \"" + project.TargetProjectXMLFile + "\" " + 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 ("haxe", 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; }
private static ExecutionCommand CreateExecutionCommand(OpenFLProject project, OpenFLProjectConfiguration configuration) { string exe = "haxe"; string args = "--run tools.haxelib.Main run openfl run \"" + project.TargetProjectXMLFile + "\" " + 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); OpenFLExecutionCommand cmd = new OpenFLExecutionCommand (exe); cmd.Arguments = args; cmd.WorkingDirectory = project.BaseDirectory.FullPath; cmd.Pathes = project.pathes.ToArray(); return cmd; }
public static void Run(OpenFLProject project, OpenFLProjectConfiguration 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.Target), 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.Target), null); } finally { operationMonitor.Dispose (); console.Dispose (); } }
public static string GetHXMLData(OpenFLProject project, OpenFLProjectConfiguration configuration) { ProcessStartInfo info = new ProcessStartInfo (); info.FileName = "haxe"; info.Arguments = "--run tools.haxelib.Main run openfl update \"" + project.TargetProjectXMLFile + "\" " + 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 tools.haxelib.Main run openfl display \"" + project.TargetProjectXMLFile + "\" " + configuration.Platform.ToLower () + " " + project.AdditionalArguments + " " + configuration.AdditionalArguments; using (Process process = Process.Start (info)) { string data = process.StandardOutput.ReadToEnd (); process.WaitForExit (); return data; } }
public static List<string> GetClassPatches(OpenFLProject project, OpenFLProjectConfiguration configuration) { List<string> patches = new List<string> (); List<string> libs = new List<string> (); string data = GetHXMLData (project, configuration); string[] dataList = data.Split (Environment.NewLine.ToCharArray()); foreach (string line in dataList) { if (line.StartsWith ("-lib ")) { libs.Add (line.Substring (5)); } else if (line.StartsWith ("-cp ")) { patches.Add (project.BaseDirectory + "/" + line.Substring (4)); } } foreach (string lib in libs) { patches.AddRange (GetLibraryPath (lib)); } return patches; }
public override SolutionItemConfiguration CreateConfiguration(string name) { OpenFLProjectConfiguration conf = new OpenFLProjectConfiguration (); conf.Name = name; return conf; }
protected override bool OnGetCanExecute(ExecutionContext context, ConfigurationSelector configurationSelector) { OpenFLProjectConfiguration haxeConfig = (OpenFLProjectConfiguration)GetConfiguration(configurationSelector); return(OpenFLCommandLineToolsManager.CanRun(this, haxeConfig, context)); }
protected override void DoExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configurationSelector) { OpenFLProjectConfiguration haxeConfig = (OpenFLProjectConfiguration)GetConfiguration(configurationSelector); OpenFLCommandLineToolsManager.Run(this, haxeConfig, monitor, context); }
protected override void DoClean(IProgressMonitor monitor, ConfigurationSelector configurationSelector) { OpenFLProjectConfiguration haxeConfig = (OpenFLProjectConfiguration)GetConfiguration(configurationSelector); OpenFLCommandLineToolsManager.Clean(this, haxeConfig, monitor); }
protected override BuildResult DoBuild(IProgressMonitor monitor, ConfigurationSelector configurationSelector) { OpenFLProjectConfiguration haxeConfig = (OpenFLProjectConfiguration)GetConfiguration(configurationSelector); return(OpenFLCommandLineToolsManager.Compile(this, haxeConfig, monitor)); }