[Monodevelop-patches-list] r1508 - in trunk/MonoDevelop/src/AddIns/BackendBindings/ILAsmBinding: . Project

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Mon Apr 26 00:19:55 EDT 2004


Author: jluke
Date: 2004-04-26 00:19:54 -0400 (Mon, 26 Apr 2004)
New Revision: 1508

Modified:
   trunk/MonoDevelop/src/AddIns/BackendBindings/ILAsmBinding/ChangeLog
   trunk/MonoDevelop/src/AddIns/BackendBindings/ILAsmBinding/ILAsmCompilerManager.cs
   trunk/MonoDevelop/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmCompilerParameters.cs
Log:
fix compiling


Modified: trunk/MonoDevelop/src/AddIns/BackendBindings/ILAsmBinding/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/ILAsmBinding/ChangeLog	2004-04-26 04:07:49 UTC (rev 1507)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/ILAsmBinding/ChangeLog	2004-04-26 04:19:54 UTC (rev 1508)
@@ -1,6 +1,8 @@
 2004-04-26  John Luke  <jluke at cfl.rr.com>
 
 	* *.cs: ILAsmBinding namespace
+	* ILAsmCompilerManager.cs: change it to work like the Java one
+	* Project/CompilationParameters.cs: use /exe and /dll
 
 
 

Modified: trunk/MonoDevelop/src/AddIns/BackendBindings/ILAsmBinding/ILAsmCompilerManager.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/ILAsmBinding/ILAsmCompilerManager.cs	2004-04-26 04:07:49 UTC (rev 1507)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/ILAsmBinding/ILAsmCompilerManager.cs	2004-04-26 04:19:54 UTC (rev 1508)
@@ -14,6 +14,7 @@
 using System.CodeDom.Compiler;
 using Gtk;
 
+using MonoDevelop.Gui.Components;
 using MonoDevelop.Services;
 using MonoDevelop.Core.Services;
 using MonoDevelop.Internal.Project;
@@ -49,8 +50,6 @@
 		ICompilerResult Compile(ILAsmCompilerParameters compilerparameters, string[] fileNames)
 		{
 			// TODO: No response file possible ? @FILENAME seems not to work.
-			string output = String.Empty;
-			string error  = String.Empty;
 			StringBuilder parameters = new StringBuilder();
 			foreach (string fileName in fileNames) {
 				parameters.Append('"');
@@ -59,21 +58,52 @@
 			}
 			
 			string outputFile = Path.GetFullPath(fileUtilityService.GetDirectoryNameWithSeparator(compilerparameters.OutputDirectory) + compilerparameters.OutputAssembly + ".exe");
-			parameters.Append("/OUTPUT=\"" + outputFile + "\"");
+			parameters.Append("/output:" + outputFile);
 			parameters.Append(" ");
 			parameters.Append(compilerparameters.CurrentCompilerOptions.GenerateOptions());
 			string compilerName = GetCompilerName();
 			string outstr = compilerName + " " + parameters.ToString();
 			
 			TempFileCollection tf = new TempFileCollection();
-			Executor.ExecWaitWithCapture(outstr, Path.GetFullPath(compilerparameters.OutputDirectory), tf, ref output, ref error);
-			
+			StreamReader output;
+			StreamReader error;
+			DoCompilation (outstr, tf, out output, out error);
 			ICompilerResult result = ParseOutput(tf, output);
 			
-			File.Delete(output);
-			File.Delete(error);
 			return result;
 		}
+
+		private void DoCompilation (string outstr, TempFileCollection tf, out StreamReader output, out StreamReader error)
+		{
+            string arguments = outstr;
+            string command = arguments;
+            ProcessStartInfo si = new ProcessStartInfo (command);
+			si.RedirectStandardOutput = true;
+            si.RedirectStandardError = true;
+			si.UseShellExecute = false;
+			Process p = new Process ();
+            p.StartInfo = si;
+            p.Start ();
+
+			IStatusBarService sbs = (IStatusBarService)ServiceManager.Services.GetService (typeof (IStatusBarService));
+			sbs.SetMessage ("Compiling...");
+
+			while (!p.HasExited) {
+				((SdStatusBar)sbs.ProgressMonitor).Pulse();
+				while (Gtk.Application.EventsPending ())
+					Gtk.Application.RunIteration ();
+				System.Threading.Thread.Sleep (100);
+			}
+
+			((SdStatusBar) sbs.ProgressMonitor).Done ();
+
+			// FIXME: avoid having a full buffer
+			// perhaps read one line and append parsed output
+			// and then return cr at end 
+			output = p.StandardOutput;
+			error = p.StandardError;
+            p.WaitForExit ();
+        }
 		
 		public ICompilerResult CompileFile(string fileName, ILAsmCompilerParameters compilerparameters)
 		{
@@ -112,11 +142,11 @@
 			return "ilasm";
 		}
 		
-		ICompilerResult ParseOutput(TempFileCollection tf, string file)
+		ICompilerResult ParseOutput(TempFileCollection tf, StreamReader sr)
 		{
 			StringBuilder compilerOutput = new StringBuilder();
 			
-			StreamReader sr = File.OpenText(file);
+			//StreamReader sr = File.OpenText(file);
 			
 			// skip fist whitespace line
 			sr.ReadLine();

Modified: trunk/MonoDevelop/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmCompilerParameters.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmCompilerParameters.cs	2004-04-26 04:07:49 UTC (rev 1507)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmCompilerParameters.cs	2004-04-26 04:19:54 UTC (rev 1508)
@@ -54,7 +54,7 @@
 		
 		[DefaultValue(CompilationTarget.Exe)]
 		[LocalizedProperty("Compilation Target",
-		                   Description = "The compilation target of the source code. (/DLL, /EXE)")]
+		                   Description = "The compilation target of the source code. (/dll, /exe)")]
 		public CompilationTarget CompilationTarget {
 			get {
 				return compilerOptions.compilationTarget;
@@ -89,7 +89,7 @@
 		public class CompilerOptions
 		{
 			[XmlAttribute("compilationTarget")]
-			internal CompilationTarget compilationTarget = CompilationTarget.Exe;
+			public CompilationTarget compilationTarget = CompilationTarget.Exe;
 			
 			[XmlAttribute("includeDebugInformation")]
 			internal bool includeDebugInformation = false;
@@ -98,12 +98,12 @@
 			{
 				StringBuilder options = new StringBuilder();
 				switch (compilationTarget) {
-					//case CompilationTarget.Dll:
-					//	options.Append("/DLL ");
-					//	break;
-					//case CompilationTarget.Exe:
-					//	options.Append("/EXE ");
-					//	break;
+					case ILAsmBinding.CompilationTarget.Dll:
+						options.Append("/dll ");
+						break;
+					case ILAsmBinding.CompilationTarget.Exe:
+						options.Append("/exe ");
+						break;
 					default:
 						throw new System.NotSupportedException("Unsupported compilation target : " + compilationTarget);
 				}




More information about the Monodevelop-patches-list mailing list