[Monodevelop-patches-list] r1470 - trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Fri Apr 16 17:05:03 EDT 2004


Author: jluke
Date: 2004-04-16 17:05:03 -0400 (Fri, 16 Apr 2004)
New Revision: 1470

Modified:
   trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/ChangeLog
   trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs
Log:
 * JavaBindingCompilerService.cs:
       rework error parsing to work off of Streams instead of temp files
       allows javac errors to work, gcj maybe not


Modified: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/ChangeLog	2004-04-16 20:39:00 UTC (rev 1469)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/ChangeLog	2004-04-16 21:05:03 UTC (rev 1470)
@@ -1,3 +1,9 @@
+2004-04-16  John Luke  <jluke at cfl.rr.com>
+
+	* JavaBindingCompilerService.cs:
+	rework error parsing to work off of Streams instead of temp files
+	allows javac errors to work, gcj maybe not	
+
 2004-04-09  John Luke  <jluke at cfl.rr.com>
 
 	* JavaBindingCompilerService.cs: account for classpath when compiling,

Modified: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs	2004-04-16 20:39:00 UTC (rev 1469)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs	2004-04-16 21:05:03 UTC (rev 1470)
@@ -27,8 +27,6 @@
 		
 		public ICompilerResult CompileFile(string filename)
 		{
-			string output = "";
-			string error  = "";
 			string options = "";
 			
 			JavaCompilerParameters cparam = new JavaCompilerParameters();
@@ -51,13 +49,11 @@
 			TempFileCollection  tf = new TempFileCollection();					
 			
 			string outstr = "javac \"" + filename + "\" -classpath " + cparam.ClassPath + options;
-			Executor.ExecWaitWithCapture(outstr, tf, ref error , ref output);
+			//Executor.ExecWaitWithCapture(outstr, tf, ref error , ref output);
+			StreamReader output, error;
+			DoCompilation (outstr, tf, out output, out error);
+			ICompilerResult cr = ParseOutput (tf, error);
 			
-			ICompilerResult cr = ParseOutput(tf, output);
-			
-			File.Delete(output);
-			File.Delete(error);
-			
 			return cr;	
 		}
 		
@@ -104,8 +100,8 @@
 			
 			options += " -encoding utf8 ";
 			
-			string output = "";
-			string error  = "";
+			//string output = "";
+			//string error  = "";
 			string files  = "";
 			
 			foreach (ProjectFile finfo in p.ProjectFiles) {
@@ -135,41 +131,42 @@
 			} else {
 				outstr = compiler + " -classpath " + compilerparameters.ClassPath + files;
 			}
-			DoCompilation (outstr, tf, ref output, ref error);
+			StreamReader output;
+			StreamReader error;
+			DoCompilation (outstr, tf, out output, out error);
 			//Executor.ExecWaitWithCapture(outstr, tf, ref error , ref output);			
-			ICompilerResult cr = ParseOutput (tf, output);			
-			File.Delete(output);
-			File.Delete(error);
+			ICompilerResult cr = ParseOutput (tf, error);			
 			
 			return cr;
 		}
 
-		private void DoCompilation (string outstr, TempFileCollection tf, ref string output, ref string error)
+		private void DoCompilation (string outstr, TempFileCollection tf, out StreamReader output, out StreamReader error)
 		{
-			output = Path.GetTempFileName ();
-            error = Path.GetTempFileName ();
-
-            string arguments = outstr + " > " + output + " 2> " + error;
+            string arguments = outstr;
             string command = arguments;
-            ProcessStartInfo si = new ProcessStartInfo("/bin/sh -c \"" + command + "\"");
+            ProcessStartInfo si = new ProcessStartInfo (command);
 			si.RedirectStandardOutput = true;
             si.RedirectStandardError = true;
 			si.UseShellExecute = false;
 			Process p = new Process ();
             p.StartInfo = si;
             p.Start ();
+			output = p.StandardOutput;
+			error = p.StandardError;
             p.WaitForExit ();
         }
 		
-		ICompilerResult ParseOutput(TempFileCollection tf, string file)
+		ICompilerResult ParseOutput(TempFileCollection tf, StreamReader errorStream)
 		{
 			string compilerOutput = "";		
-			StreamReader sr = new StreamReader(file, System.Text.Encoding.Default);
+			StreamReader sr = errorStream;
+			
 			CompilerResults cr = new CompilerResults(tf);
 			
 			while (true) 
 				{
-				string next = sr.ReadLine();									
+				string next = sr.ReadLine ();
+				Console.WriteLine (next);
 				
 				if (next == null)
 					break;




More information about the Monodevelop-patches-list mailing list