Crossgen now requires a Jit package to be specified.
Port Crossgen fix from core-setup.
See a2857af7e3
This commit is contained in:
parent
748516bb0d
commit
82ef0304bb
5 changed files with 66 additions and 36 deletions
|
@ -56,7 +56,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
|
|
||||||
public const string SharedFrameworkName = "Microsoft.NETCore.App";
|
public const string SharedFrameworkName = "Microsoft.NETCore.App";
|
||||||
|
|
||||||
public static Crossgen CrossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion);
|
public static Crossgen CrossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion, DependencyVersions.JitVersion);
|
||||||
|
|
||||||
// Updates the stage 2 with recent changes.
|
// Updates the stage 2 with recent changes.
|
||||||
[Target(nameof(PrepareTargets.Init), nameof(CompileStage2))]
|
[Target(nameof(PrepareTargets.Init), nameof(CompileStage2))]
|
||||||
|
|
|
@ -8,5 +8,6 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
public class DependencyVersions
|
public class DependencyVersions
|
||||||
{
|
{
|
||||||
public static readonly string CoreCLRVersion = "1.0.2-rc3-24206-00";
|
public static readonly string CoreCLRVersion = "1.0.2-rc3-24206-00";
|
||||||
|
public static readonly string JitVersion = "1.0.2-rc3-24206-00";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,9 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
public class Crossgen
|
public class Crossgen
|
||||||
{
|
{
|
||||||
private string _coreClrVersion;
|
private string _coreClrVersion;
|
||||||
|
private string _jitVersion;
|
||||||
private string _crossGenPath;
|
private string _crossGenPath;
|
||||||
private static readonly string[] s_excludedLibraries =
|
private static readonly string[] s_excludedLibraries =
|
||||||
{
|
{
|
||||||
"mscorlib.dll",
|
"mscorlib.dll",
|
||||||
"mscorlib.ni.dll",
|
"mscorlib.ni.dll",
|
||||||
|
@ -25,9 +26,10 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
// in CompileTargets and the one in the shared library project.json match and are updated in lock step, but long term
|
// in CompileTargets and the one in the shared library project.json match and are updated in lock step, but long term
|
||||||
// we need to be able to look at the project.lock.json file and figure out what version of Microsoft.NETCore.Runtime.CoreCLR
|
// we need to be able to look at the project.lock.json file and figure out what version of Microsoft.NETCore.Runtime.CoreCLR
|
||||||
// was used, and then select that version.
|
// was used, and then select that version.
|
||||||
public Crossgen(string coreClrVersion)
|
public Crossgen(string coreClrVersion, string jitVersion)
|
||||||
{
|
{
|
||||||
_coreClrVersion = coreClrVersion;
|
_coreClrVersion = coreClrVersion;
|
||||||
|
_jitVersion = jitVersion;
|
||||||
_crossGenPath = GetCrossgenPathForVersion();
|
_crossGenPath = GetCrossgenPathForVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,21 +50,59 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
|
|
||||||
private string GetLibCLRJitPathForVersion()
|
private string GetLibCLRJitPathForVersion()
|
||||||
{
|
{
|
||||||
var coreclrRid = GetCoreCLRRid();
|
var jitRid = GetCoreCLRRid();
|
||||||
var crossgenPackagePath = GetCrossGenPackagePathForVersion();
|
var jitPackagePath = GetJitPackagePathForVersion();
|
||||||
|
|
||||||
if (crossgenPackagePath == null)
|
if (jitPackagePath == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Path.Combine(
|
return Path.Combine(
|
||||||
crossgenPackagePath,
|
jitPackagePath,
|
||||||
"runtimes",
|
"runtimes",
|
||||||
coreclrRid,
|
jitRid,
|
||||||
"native",
|
"native",
|
||||||
$"{Constants.DynamicLibPrefix}clrjit{Constants.DynamicLibSuffix}");
|
$"{Constants.DynamicLibPrefix}clrjit{Constants.DynamicLibSuffix}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetJitPackagePathForVersion()
|
||||||
|
{
|
||||||
|
string jitRid = GetCoreCLRRid();
|
||||||
|
|
||||||
|
if (jitRid == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
string packageId = $"runtime.{jitRid}.Microsoft.NETCore.Jit";
|
||||||
|
|
||||||
|
return Path.Combine(
|
||||||
|
Dirs.NuGetPackages,
|
||||||
|
packageId,
|
||||||
|
_jitVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetCoreLibsDirForVersion()
|
||||||
|
{
|
||||||
|
string coreclrRid = GetCoreCLRRid();
|
||||||
|
|
||||||
|
if (coreclrRid == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
string packageId = $"runtime.{coreclrRid}.Microsoft.NETCore.Runtime.CoreCLR";
|
||||||
|
|
||||||
|
return Path.Combine(
|
||||||
|
Dirs.NuGetPackages,
|
||||||
|
packageId,
|
||||||
|
_coreClrVersion,
|
||||||
|
"runtimes",
|
||||||
|
coreclrRid,
|
||||||
|
"lib",
|
||||||
|
"netstandard1.0");
|
||||||
|
}
|
||||||
|
|
||||||
private string GetCrossGenPackagePathForVersion()
|
private string GetCrossGenPackagePathForVersion()
|
||||||
{
|
{
|
||||||
|
@ -73,7 +113,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
string packageId = $"runtime.{coreclrRid}.Microsoft.NETCore.Runtime.CoreCLR";
|
string packageId = $"runtime.{coreclrRid}.Microsoft.NETCore.Runtime.CoreCLR";
|
||||||
|
|
||||||
return Path.Combine(
|
return Path.Combine(
|
||||||
Dirs.NuGetPackages,
|
Dirs.NuGetPackages,
|
||||||
|
@ -89,34 +129,23 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
var arch = RuntimeEnvironment.RuntimeArchitecture;
|
var arch = RuntimeEnvironment.RuntimeArchitecture;
|
||||||
rid = $"win7-{arch}";
|
rid = $"win7-{arch}";
|
||||||
}
|
}
|
||||||
else if (CurrentPlatform.IsUbuntu)
|
|
||||||
{
|
|
||||||
rid = $"ubuntu.{RuntimeEnvironment.OperatingSystemVersion}-x64";
|
|
||||||
}
|
|
||||||
else if (CurrentPlatform.IsCentOS || CurrentPlatform.IsRHEL)
|
|
||||||
{
|
|
||||||
// CentOS runtime is in the runtime.rhel.7-x64... package.
|
|
||||||
rid = "rhel.7-x64";
|
|
||||||
}
|
|
||||||
else if (CurrentPlatform.IsOSX)
|
else if (CurrentPlatform.IsOSX)
|
||||||
{
|
{
|
||||||
rid = "osx.10.10-x64";
|
rid = "osx.10.10-x64";
|
||||||
}
|
}
|
||||||
else if (CurrentPlatform.IsDebian)
|
else if (CurrentPlatform.IsCentOS || CurrentPlatform.IsRHEL)
|
||||||
{
|
{
|
||||||
rid = "debian.8-x64";
|
// CentOS runtime is in the runtime.rhel.7-x64... package as are all
|
||||||
|
// versions of RHEL
|
||||||
|
rid = "rhel.7-x64";
|
||||||
}
|
}
|
||||||
else if (CurrentPlatform.IsFedora)
|
else if (CurrentPlatform.IsLinux)
|
||||||
{
|
{
|
||||||
rid = $"fedora.{RuntimeEnvironment.OperatingSystemVersion}-x64";
|
rid = RuntimeEnvironment.GetRuntimeIdentifier();
|
||||||
}
|
|
||||||
else if (CurrentPlatform.IsOpenSuse)
|
|
||||||
{
|
|
||||||
rid = $"opensuse.{RuntimeEnvironment.OperatingSystemVersion}-x64";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rid;
|
return rid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CrossgenDirectory(string sharedFxPath, string pathToAssemblies)
|
public void CrossgenDirectory(string sharedFxPath, string pathToAssemblies)
|
||||||
{
|
{
|
||||||
|
@ -137,10 +166,12 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
// The right fix -
|
// The right fix -
|
||||||
// If the assembly has deps.json then parse the json file to get all the dependencies, pass these dependencies as input to crossgen.
|
// If the assembly has deps.json then parse the json file to get all the dependencies, pass these dependencies as input to crossgen.
|
||||||
// else pass the current directory of assembly as input to crossgen.
|
// else pass the current directory of assembly as input to crossgen.
|
||||||
|
var coreLibsDir = GetCoreLibsDirForVersion();
|
||||||
var addtionalPaths = Directory.GetDirectories(pathToAssemblies, "*", SearchOption.AllDirectories).ToList();
|
var addtionalPaths = Directory.GetDirectories(pathToAssemblies, "*", SearchOption.AllDirectories).ToList();
|
||||||
var paths = new List<string>() { sharedFxPath, pathToAssemblies };
|
var paths = new List<string>() { coreLibsDir, sharedFxPath, pathToAssemblies };
|
||||||
paths.AddRange(addtionalPaths);
|
paths.AddRange(addtionalPaths);
|
||||||
var platformAssembliesPaths = string.Join(Path.PathSeparator.ToString(), paths.Distinct());
|
var platformAssembliesPaths = string.Join(Path.PathSeparator.ToString(), paths.Distinct());
|
||||||
|
var jitPath = GetLibCLRJitPathForVersion();
|
||||||
|
|
||||||
var env = new Dictionary<string, string>()
|
var env = new Dictionary<string, string>()
|
||||||
{
|
{
|
||||||
|
@ -152,7 +183,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
string fileName = Path.GetFileName(file);
|
string fileName = Path.GetFileName(file);
|
||||||
|
|
||||||
if (s_excludedLibraries.Any(lib => String.Equals(lib, fileName, StringComparison.OrdinalIgnoreCase))
|
if (s_excludedLibraries.Any(lib => String.Equals(lib, fileName, StringComparison.OrdinalIgnoreCase))
|
||||||
|| !PEUtils.HasMetadata(file))
|
|| !PEUtils.HasMetadata(file))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -165,11 +196,8 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
"-platform_assemblies_paths", platformAssembliesPaths
|
"-platform_assemblies_paths", platformAssembliesPaths
|
||||||
};
|
};
|
||||||
|
|
||||||
if (CurrentPlatform.IsUnix)
|
crossgenArgs.Add("-JITPath");
|
||||||
{
|
crossgenArgs.Add(jitPath);
|
||||||
crossgenArgs.Add("-JITPath");
|
|
||||||
crossgenArgs.Add(GetLibCLRJitPathForVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
ExecSilent(_crossGenPath, crossgenArgs, env);
|
ExecSilent(_crossGenPath, crossgenArgs, env);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
private string _corehostLockedDirectory;
|
private string _corehostLockedDirectory;
|
||||||
private string _corehostLatestDirectory;
|
private string _corehostLatestDirectory;
|
||||||
|
|
||||||
private Crossgen _crossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion);
|
private Crossgen _crossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion, DependencyVersions.JitVersion);
|
||||||
private string _corehostPackageSource;
|
private string _corehostPackageSource;
|
||||||
|
|
||||||
public SharedFrameworkPublisher(
|
public SharedFrameworkPublisher(
|
||||||
|
|
|
@ -212,6 +212,7 @@ namespace Microsoft.DotNet.Scripts
|
||||||
ReplaceFileContents(@"build_projects\shared-build-targets-utils\DependencyVersions.cs", fileContents =>
|
ReplaceFileContents(@"build_projects\shared-build-targets-utils\DependencyVersions.cs", fileContents =>
|
||||||
{
|
{
|
||||||
fileContents = ReplaceDependencyVersion(c, fileContents, "CoreCLRVersion", "Microsoft.NETCore.Runtime.CoreCLR");
|
fileContents = ReplaceDependencyVersion(c, fileContents, "CoreCLRVersion", "Microsoft.NETCore.Runtime.CoreCLR");
|
||||||
|
fileContents = ReplaceDependencyVersion(c, fileContents, "JitVersion", "Microsoft.NETCore.Jit");
|
||||||
|
|
||||||
return fileContents;
|
return fileContents;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue