no longer need to crossgen the CLI

thank you shared framework!
This commit is contained in:
Andrew Stanton-Nurse 2016-03-28 21:42:04 -07:00
parent dc41c9b026
commit bca338801a

View file

@ -18,8 +18,6 @@ namespace Microsoft.DotNet.Cli.Build
public static readonly string AppDepSdkVersion = "1.0.6-prerelease-00003"; public static readonly string AppDepSdkVersion = "1.0.6-prerelease-00003";
public static readonly bool IsWinx86 = CurrentPlatform.IsWindows && CurrentArchitecture.Isx86; public static readonly bool IsWinx86 = CurrentPlatform.IsWindows && CurrentArchitecture.Isx86;
public static readonly List<string> AssembliesToCrossGen = GetAssembliesToCrossGen();
public static readonly string[] BinariesForCoreHost = new[] public static readonly string[] BinariesForCoreHost = new[]
{ {
"csi", "csi",
@ -478,13 +476,6 @@ namespace Microsoft.DotNet.Cli.Build
File.Delete(compilersDeps); File.Delete(compilersDeps);
File.Delete(compilersRuntimeConfig); File.Delete(compilersRuntimeConfig);
// Crossgen Roslyn
var result = CrossgenCliSdk(c, outputDir);
if (!result.Success)
{
return result;
}
// Copy AppDeps // Copy AppDeps
result = CopyAppDeps(c, outputDir); result = CopyAppDeps(c, outputDir);
if (!result.Success) if (!result.Success)
@ -547,62 +538,6 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success(); return c.Success();
} }
private static BuildTargetResult CrossgenCliSdk(BuildTargetContext c, string outputDir)
{
// Check if we need to skip crossgen
if (string.Equals(Environment.GetEnvironmentVariable("DOTNET_BUILD_SKIP_CROSSGEN"), "1"))
{
c.Warn("Skipping crossgen for Cli Sdk because DOTNET_BUILD_SKIP_CROSSGEN is set");
return c.Success();
}
// Find crossgen
var crossGenExePath = Microsoft.DotNet.Cli.Build.Crossgen.GetCrossgenPathForVersion(CoreCLRVersion);
if (string.IsNullOrEmpty(crossGenExePath))
{
return c.Failed("Unsupported OS Platform");
}
// We have to copy crossgen next to mscorlib
var crossgen = Path.Combine(outputDir, $"crossgen{Constants.ExeSuffix}");
File.Copy(crossGenExePath, crossgen, overwrite: true);
Chmod(crossgen, "a+x");
// And if we have mscorlib.ni.dll, we need to rename it to mscorlib.dll
if (File.Exists(Path.Combine(outputDir, "mscorlib.ni.dll")))
{
File.Copy(Path.Combine(outputDir, "mscorlib.ni.dll"), Path.Combine(outputDir, "mscorlib.dll"), overwrite: true);
}
foreach (var assemblyToCrossgen in AssembliesToCrossGen)
{
c.Info($"Crossgenning {assemblyToCrossgen}");
ExecInSilent(outputDir,
crossgen,
"-readytorun",
"-nologo",
"-platform_assemblies_paths",
$"{outputDir}{Path.PathSeparator}{c.BuildContext["SharedFrameworkPath"]}",
assemblyToCrossgen);
}
c.Info("Crossgen complete");
// Check if csc/vbc.ni.exe exists, and overwrite the dll with it just in case
if (File.Exists(Path.Combine(outputDir, "csc.ni.exe")) && !File.Exists(Path.Combine(outputDir, "csc.ni.dll")))
{
File.Move(Path.Combine(outputDir, "csc.ni.exe"), Path.Combine(outputDir, "csc.ni.dll"));
}
if (File.Exists(Path.Combine(outputDir, "vbc.ni.exe")) && !File.Exists(Path.Combine(outputDir, "vbc.ni.dll")))
{
File.Move(Path.Combine(outputDir, "vbc.ni.exe"), Path.Combine(outputDir, "vbc.ni.dll"));
}
return c.Success();
}
public static BuildTargetResult CrossgenSharedFx(BuildTargetContext c, string pathToAssemblies) public static BuildTargetResult CrossgenSharedFx(BuildTargetContext c, string pathToAssemblies)
{ {
// Check if we need to skip crossgen // Check if we need to skip crossgen
@ -661,19 +596,5 @@ namespace Microsoft.DotNet.Cli.Build
return false; return false;
} }
private static List<string> GetAssembliesToCrossGen()
{
return new List<string>
{
"System.Collections.Immutable.dll",
"System.Reflection.Metadata.dll",
"Microsoft.CodeAnalysis.dll",
"Microsoft.CodeAnalysis.CSharp.dll",
"Microsoft.CodeAnalysis.VisualBasic.dll",
"csc.dll",
"vbc.dll"
};
}
} }
} }