[Monodevelop-patches-list] r540 - in trunk/MonoDevelop/src/AddIns: BackendBindings/CSharpBinding DisplayBindings/TextEditor/Gui/Pads

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sun Jan 18 08:20:30 EST 2004


Author: pedroas
Date: 2004-01-18 08:20:30 -0500 (Sun, 18 Jan 2004)
New Revision: 540

Modified:
   trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingCompilerManager.cs
   trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Pads/CompilerMessageView.cs
Log:
Tiny support for compiling projects


Modified: trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingCompilerManager.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingCompilerManager.cs	2004-01-18 11:08:04 UTC (rev 539)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingCompilerManager.cs	2004-01-18 13:20:30 UTC (rev 540)
@@ -151,8 +151,8 @@
 				}
 				
 				writer.WriteLine("/nologo");
-				writer.WriteLine("/utf8output");
-				writer.WriteLine("/w:" + compilerparameters.WarningLevel);;
+//				writer.WriteLine("/utf8output");
+//				writer.WriteLine("/w:" + compilerparameters.WarningLevel);;
 				
 				if (compilerparameters.Debugmode) {
 					writer.WriteLine("/debug:+");
@@ -160,9 +160,9 @@
 					writer.WriteLine("/d:DEBUG");
 				}
 				
-				if (compilerparameters.Optimize) {
-					writer.WriteLine("/o");
-				}
+//				if (compilerparameters.Optimize) {
+//					writer.WriteLine("/o");
+//				}
 				
 				if (compilerparameters.Win32Icon != null && compilerparameters.Win32Icon.Length > 0 && File.Exists(compilerparameters.Win32Icon)) {
 					writer.WriteLine("\"/win32icon:" + compilerparameters.Win32Icon + "\"");
@@ -260,8 +260,15 @@
 			string outstr = compilerName + " @" + responseFileName;
 			TempFileCollection tf = new TempFileCollection();
 			
-			Executor.ExecWaitWithCapture(outstr,  tf, ref output, ref error);
 			
+			StreamReader t = File.OpenText(responseFileName);
+			StreamWriter w = new StreamWriter("/home/pedro/mirame");
+			w.Write(t.ReadToEnd());
+			w.Close();
+			
+			//Executor.ExecWaitWithCapture(outstr,  tf, ref output, ref error);
+			DoCompilation(outstr, tf, ref output, ref error);
+			
 			ICompilerResult result = ParseOutput(tf, output);
 			project.CopyReferencesToOutputPath(false);
 			File.Delete(responseFileName);
@@ -272,8 +279,13 @@
 		
 		string GetCompilerName()
 		{
-			return fileUtilityService.GetDirectoryNameWithSeparator(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()) + 
-			       "csc.exe";
+			//return fileUtilityService.GetDirectoryNameWithSeparator(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()) + 
+			//       "csc.exe";
+			string ret = fileUtilityService.GetDirectoryNameWithSeparator(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory());
+			ret = ret.Substring(0, ret.Length - 4);
+			ret = ret + "bin/mcs";
+			return ret;
+			
 		}
 		
 		ICompilerResult ParseOutput(TempFileCollection tf, string file)
@@ -283,7 +295,7 @@
 			StreamReader sr = File.OpenText(file);
 			
 			// skip fist whitespace line
-			sr.ReadLine();
+			//sr.ReadLine();
 			
 			CompilerResults cr = new CompilerResults(tf);
 			
@@ -332,5 +344,20 @@
 			sr.Close();
 			return new DefaultCompilerResult(cr, compilerOutput.ToString());
 		}
+		
+		private void DoCompilation(string outstr, TempFileCollection tf, ref string output, ref string error) {
+			output = Path.GetTempFileName();
+			error = Path.GetTempFileName();
+			
+			string arguments = outstr + " > " + output + " 2> " + error;
+			string command = arguments;
+			ProcessStartInfo si = new ProcessStartInfo("/bin/sh -c \"" + command + "\"");
+			si.RedirectStandardOutput = true;
+			si.RedirectStandardError = true;
+			Process p = new Process();
+			p.StartInfo = si;
+			p.Start();
+			p.WaitForExit();
+		}
 	}
 }

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Pads/CompilerMessageView.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Pads/CompilerMessageView.cs	2004-01-18 11:08:04 UTC (rev 539)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Pads/CompilerMessageView.cs	2004-01-18 13:20:30 UTC (rev 540)
@@ -115,7 +115,8 @@
 			
 		}
 		
-		void SetOutput2(object sender, EventArgs e)
+		//void SetOutput2(object sender, EventArgs e)
+		void SetOutput2()
 		{
 			TaskService taskService = (TaskService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(TaskService));
 			try {
@@ -128,7 +129,7 @@
 		
 		void UpdateTextArea()
 		{
-			Console.WriteLine("Create CompilerMessage View Handle:" + textEditorControl.Handle);
+			//Console.WriteLine("Create CompilerMessage View Handle:" + textEditorControl.Handle);
 			
 			textEditorControl.ActiveTextAreaControl.Caret.Position = textEditorControl.Document.OffsetToPosition(textEditorControl.Document.TextLength);
 			textEditorControl.ActiveTextAreaControl.ScrollToCaret();
@@ -137,9 +138,10 @@
 		string outputText = null;
 		void SetOutput(object sender, EventArgs e)
 		{
-			Console.WriteLine("Create CompilerMessage View Handle:" + textEditorControl.Handle);
-			
+			//Console.WriteLine("Create CompilerMessage View Handle:" + textEditorControl.Handle);
+			//throw new Exception("Trace me...");
 			if (WorkbenchSingleton.Workbench.WorkbenchLayout.IsVisible(this)) {
+				SetOutput2();
 				//textEditorControl.Invoke(new EventHandler(SetOutput2));
 				outputText = null;
 			} else {




More information about the Monodevelop-patches-list mailing list