Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@ -48,54 +48,9 @@ namespace Mono.CSharp
internal class CSharpCodeCompiler : CSharpCodeGenerator, ICodeCompiler
{
static string windowsMcsPath;
static string windowsMonoPath;
static string unixMcsCommand;
Mutex mcsOutMutex;
StringCollection mcsOutput;
static CSharpCodeCompiler ()
{
if (Path.DirectorySeparatorChar == '\\') {
PropertyInfo gac = typeof (Environment).GetProperty ("GacPath", BindingFlags.Static|BindingFlags.NonPublic);
MethodInfo get_gac = gac.GetGetMethod (true);
string p = Path.GetDirectoryName (
(string) get_gac.Invoke (null, null));
windowsMonoPath = Path.Combine (
Path.GetDirectoryName (
Path.GetDirectoryName (p)),
"bin\\mono.bat");
if (!File.Exists (windowsMonoPath))
windowsMonoPath = Path.Combine (
Path.GetDirectoryName (
Path.GetDirectoryName (p)),
"bin\\mono.exe");
if (!File.Exists (windowsMonoPath))
windowsMonoPath = Path.Combine (
Path.GetDirectoryName (
Path.GetDirectoryName (
Path.GetDirectoryName (p))),
"mono\\mono\\mini\\mono.exe");
if (!File.Exists (windowsMonoPath))
throw new FileNotFoundException ("Windows mono path not found: " + windowsMonoPath);
windowsMcsPath = Path.Combine (p, "4.5\\mcs.exe");
if (!File.Exists (windowsMcsPath))
windowsMcsPath = Path.Combine(Path.GetDirectoryName (p), "lib\\build\\mcs.exe");
if (!File.Exists (windowsMcsPath))
throw new FileNotFoundException ("Windows mcs path not found: " + windowsMcsPath);
} else {
var mscorlibPath = new Uri (typeof (object).Assembly.CodeBase).LocalPath;
var unixMcsPath = Path.GetFullPath (Path.Combine (mscorlibPath, "..", "..", "..", "..", "bin", "mcs"));
if (File.Exists (unixMcsPath))
unixMcsCommand = unixMcsPath;
else
unixMcsCommand = "mcs";
}
}
//
// Constructors
//
@ -177,14 +132,14 @@ namespace Mono.CSharp
// FIXME: these lines had better be platform independent.
if (Path.DirectorySeparatorChar == '\\') {
mcs.StartInfo.FileName = windowsMonoPath;
mcs.StartInfo.Arguments = "\"" + windowsMcsPath + "\" " +
BuildArgs (options, fileNames, ProviderOptions);
mcs.StartInfo.FileName = MonoToolsLocator.Mono;
mcs.StartInfo.Arguments = "\"" + MonoToolsLocator.McsCSharpCompiler + "\" ";
} else {
mcs.StartInfo.FileName=unixMcsCommand;
mcs.StartInfo.Arguments=BuildArgs(options, fileNames, ProviderOptions);
mcs.StartInfo.FileName = MonoToolsLocator.McsCSharpCompiler;
}
mcs.StartInfo.Arguments += BuildArgs (options, fileNames, ProviderOptions);
mcsOutput = new StringCollection ();
mcsOutMutex = new Mutex ();
/*
@ -226,7 +181,7 @@ namespace Mono.CSharp
Win32Exception exc = e as Win32Exception;
if (exc != null) {
throw new SystemException (String.Format ("Error running {0}: {1}", mcs.StartInfo.FileName,
Win32Exception.W32ErrorMessage (exc.NativeErrorCode)));
Win32Exception.GetErrorMessage (exc.NativeErrorCode)));
}
throw;
}