[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System/CodeDom/Compiler CSharpCodeCom
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System/CodeDom/Compiler CSharpCodeCompiler.cs, 1.7, 1.8 CodeCompiler.cs, 1.5, 1.6 |
Date: |
Wed, 03 Sep 2003 00:41:39 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System/CodeDom/Compiler
In directory subversions:/tmp/cvs-serv12466/System/CodeDom/Compiler
Modified Files:
CSharpCodeCompiler.cs CodeCompiler.cs
Log Message:
Implement the remaining TODO's in "System.CodeDom.Compiler".
Index: CSharpCodeCompiler.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/System/CodeDom/Compiler/CSharpCodeCompiler.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** CSharpCodeCompiler.cs 3 Sep 2003 01:30:02 -0000 1.7
--- CSharpCodeCompiler.cs 3 Sep 2003 04:41:37 -0000 1.8
***************
*** 29,32 ****
--- 29,33 ----
using System.Globalization;
using System.Text;
+ using System.Diagnostics;
internal class CSharpCodeCompiler : CodeCompiler
***************
*** 102,108 ****
private static String[] ArgsFromOptions(String options)
{
! String[] args = new String [0];
! // TODO
! return args;
}
--- 103,107 ----
private static String[] ArgsFromOptions(String options)
{
! return
ProcessStartInfo.ArgumentsToArgV(options);
}
Index: CodeCompiler.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/CodeDom/Compiler/CodeCompiler.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** CodeCompiler.cs 2 Sep 2003 06:50:11 -0000 1.5
--- CodeCompiler.cs 3 Sep 2003 04:41:37 -0000 1.6
***************
*** 26,29 ****
--- 26,30 ----
using System.IO;
+ using System.Collections;
using System.Reflection;
using System.Diagnostics;
***************
*** 118,123 ****
(CompilerParameters options, String[] fileNames)
{
! // TODO
! return null;
}
--- 119,202 ----
(CompilerParameters options, String[] fileNames)
{
! // Add an output filename to the options if
necessary.
! if(options.OutputAssembly == null ||
! options.OutputAssembly.Length == 0)
! {
! if(options.GenerateExecutable)
! {
! options.OutputAssembly =
options.TempFiles.AddExtension
! ("exe",
!(options.GenerateInMemory));
! }
! else
! {
! options.OutputAssembly =
options.TempFiles.AddExtension
! ("dll",
!(options.GenerateInMemory));
! }
! }
!
! // Build the full command-line to pass to the
compiler.
! String args = CmdArgsFromParameters(options);
! args = args + " " + JoinStringArray(fileNames,
" ");
!
! // If the argument array is too long, then
write the
! // command-line to a temporary file and use
"@file".
! if(args.Length > 100)
! {
! args = GetResponseFileCmdArgs(options,
args);
! }
!
! // Create a compiler results block.
! CompilerResults results;
! results = new
CompilerResults(options.TempFiles);
!
! // Build the process start info block.
! ProcessStartInfo startInfo;
! startInfo = new ProcessStartInfo(CompilerName,
args);
! startInfo.RedirectStandardError = true;
!
! // Create and run the process.
! Process process = Process.Start(startInfo);
!
! // Read the stderr stream until EOF.
! String line;
! while((line = process.StandardError.ReadLine())
!= null)
! {
! results.Output.Add(line);
! ProcessCompilerOutputLine(results,
line);
! }
!
! // Wait for the process to exit and record the
return code.
! process.WaitForExit();
! results.NativeCompilerReturnValue =
process.ExitCode;
! process.Close();
!
! // Load the assembly into memory if necessary.
! if(!(results.Errors.HasErrors) &&
options.GenerateInMemory)
! {
! FileStream stream;
! stream = new
FileStream(options.OutputAssembly,
!
FileMode.Open, FileAccess.Read,
!
FileShare.Read);
! try
! {
! // We must use the memory-based
load method,
! // because "OutputAssembly" may
be deleted
! // before we are done with the
assembly.
! byte[] buf = new byte
[(int)(stream.Length)];
! stream.Read(buf, 0, buf.Length);
! results.CompiledAssembly =
Assembly.Load(buf);
! }
! finally
! {
! stream.Close();
! }
! }
! else
! {
! results.PathToAssembly =
options.OutputAssembly;
! }
!
! // Return the final results to the caller.
! return results;
}
***************
*** 143,147 ****
{
tempFiles[src] =
options.TempFiles.AddExtension
! (src + FileExtension);
stream = new FileStream(tempFiles[src],
FileMode.Create,
FileAccess.Write, FileShare.Read);
--- 222,226 ----
{
tempFiles[src] =
options.TempFiles.AddExtension
! (src + "." +
FileExtension);
stream = new FileStream(tempFiles[src],
FileMode.Create,
FileAccess.Write, FileShare.Read);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System/CodeDom/Compiler CSharpCodeCompiler.cs, 1.7, 1.8 CodeCompiler.cs, 1.5, 1.6,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/System/CodeDom/Compiler CSharpCodeCompiler.cs, 1.6, 1.7 VBCodeCompiler.cs, 1.3, 1.4
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.1320,1.1321
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/System/CodeDom/Compiler CSharpCodeCompiler.cs, 1.6, 1.7 VBCodeCompiler.cs, 1.3, 1.4
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.1320,1.1321
- Index(es):