switch to latest coreclr

This commit is contained in:
Andrew Stanton-Nurse 2015-10-28 14:35:29 -07:00
parent a29ebe05ff
commit a715be1d59
26 changed files with 98 additions and 150 deletions

View file

@ -12,8 +12,6 @@ namespace Microsoft.DotNet.Tools.Publish
{
public class Program
{
public static readonly IEnumerable<string> CoreCLRFileNames = GetCoreCLRFileNames();
public static int Main(string[] args)
{
DebugHelper.HandleDebugSwitch(ref args);
@ -157,9 +155,18 @@ namespace Microsoft.DotNet.Tools.Publish
private static int PublishForUnix(ProjectContext context, string outputPath)
{
CopyCoreCLR(outputPath);
var coreConsole = Path.Combine(outputPath, Constants.CoreConsoleName);
if(!File.Exists(coreConsole))
{
Reporter.Error.WriteLine($"Cannot find {Constants.CoreConsoleName} in the output. You must have a direct dependency on Microsoft.NETCore.ConsoleHost (for now)");
return 1;
}
var coreRun = Path.Combine(outputPath, Constants.CoreRunName);
if(!File.Exists(coreRun))
{
Reporter.Error.WriteLine($"Cannot find {Constants.CoreRunName} in the output. You must have a direct dependency on Microsoft.NETCore.TestHost (for now)");
return 1;
}
// Use the 'command' field to generate the name
var outputExe = Path.Combine(outputPath, context.ProjectFile.Name);
@ -193,9 +200,18 @@ exec ""$DIR/corerun"" ""$DIR/{context.ProjectFile.Name}.exe"" $*
return 0;
}
CopyCoreCLR(outputPath);
var coreConsole = Path.Combine(outputPath, Constants.CoreConsoleName);
if(!File.Exists(coreConsole))
{
Reporter.Error.WriteLine($"Cannot find {Constants.CoreConsoleName} in the output. You must have a direct dependency on Microsoft.NETCore.ConsoleHost (for now)".Red());
return 1;
}
var coreRun = Path.Combine(outputPath, Constants.CoreRunName);
if(!File.Exists(coreRun))
{
Reporter.Error.WriteLine($"Cannot find {Constants.CoreRunName} in the output. You must have a direct dependency on Microsoft.NETCore.TestHost (for now)".Red());
return 1;
}
var outputExe = Path.Combine(outputPath, context.ProjectFile.Name + Constants.ExeSuffix);
@ -207,17 +223,6 @@ exec ""$DIR/corerun"" ""$DIR/{context.ProjectFile.Name}.exe"" $*
return 0;
}
private static void CopyCoreCLR(string outputPath)
{
// TEMPORARILY bring checked-in CoreCLR stuff along for the ride.
var clrPath = AppContext.BaseDirectory;
foreach(var file in CoreCLRFileNames)
{
File.Copy(Path.Combine(clrPath, file), Path.Combine(outputPath, file), overwrite: true);
}
}
private static void CopyContents(ProjectContext context, string outputPath)
{
var sourceFiles = context.ProjectFile.Files.GetFilesForBundling();
@ -289,32 +294,5 @@ exec ""$DIR/corerun"" ""$DIR/{context.ProjectFile.Name}.exe"" $*
File.Copy(file, Path.Combine(outputPath, Path.GetFileName(file)), overwrite: true);
}
}
private static IEnumerable<string> GetCoreCLRFileNames()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
yield return "coreclr.dll";
yield return "CoreConsole.exe";
yield return "CoreRun.exe";
yield return "mscorlib.ni.dll";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
yield return "libcoreclr.dylib";
yield return "coreconsole";
yield return "corerun";
yield return "mscorlib.dll";
yield return "System.Globalization.Native.dylib";
}
else
{
yield return "libcoreclr.so";
yield return "coreconsole";
yield return "corerun";
yield return "mscorlib.dll";
yield return "System.Globalization.Native.so";
}
}
}
}