replace crossgen with crossgen2
crossgen is now defunct. This is validated on windows x64. More work will be required to get it to work across OS/arch.
This commit is contained in:
parent
a5ca14075b
commit
88b8fc6b33
2 changed files with 21 additions and 25 deletions
|
@ -41,8 +41,6 @@ namespace Microsoft.DotNet.Build.Tasks
|
|||
|
||||
private string TempOutputPath { get; set; }
|
||||
|
||||
private bool _secondInvocationToCreateSymbols;
|
||||
|
||||
protected override bool ValidateParameters()
|
||||
{
|
||||
base.ValidateParameters();
|
||||
|
@ -67,7 +65,15 @@ namespace Microsoft.DotNet.Build.Tasks
|
|||
|
||||
if (toolResult)
|
||||
{
|
||||
File.Copy(TempOutputPath, DestinationPath, overwrite: true);
|
||||
var files = System.IO.Directory.GetFiles(Path.GetDirectoryName(TempOutputPath));
|
||||
var dest = Path.GetDirectoryName(DestinationPath);
|
||||
// Copy both dll and pdb files to the destination folder
|
||||
foreach(var file in files)
|
||||
{
|
||||
File.Copy(file, $"{dest}{Path.GetFileName(file)}", overwrite: true);
|
||||
// Delete file in temp
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (File.Exists(TempOutputPath))
|
||||
|
@ -76,18 +82,12 @@ namespace Microsoft.DotNet.Build.Tasks
|
|||
}
|
||||
Directory.Delete(tempDirPath);
|
||||
|
||||
if (toolResult && CreateSymbols)
|
||||
{
|
||||
_secondInvocationToCreateSymbols = true;
|
||||
toolResult = base.Execute();
|
||||
}
|
||||
|
||||
return toolResult;
|
||||
}
|
||||
|
||||
protected override string ToolName
|
||||
{
|
||||
get { return "crossgen"; }
|
||||
get { return "crossgen2"; }
|
||||
}
|
||||
|
||||
protected override MessageImportance StandardOutputLoggingImportance
|
||||
|
@ -133,23 +133,18 @@ namespace Microsoft.DotNet.Build.Tasks
|
|||
return CrossgenPath;
|
||||
}
|
||||
|
||||
return "crossgen";
|
||||
return "crossgen2";
|
||||
}
|
||||
|
||||
protected override string GenerateCommandLineCommands()
|
||||
{
|
||||
if (_secondInvocationToCreateSymbols)
|
||||
{
|
||||
return $"{GetReadyToRun()} {GetPlatformAssemblyPaths()} {GetDiasymReaderPath()} {GetCreateSymbols()}";
|
||||
}
|
||||
|
||||
return $"{GetReadyToRun()} {GetMissingDependenciesOk()} {GetInPath()} {GetOutPath()} {GetPlatformAssemblyPaths()} {GetJitPath()}";
|
||||
return $"{GetInPath()} {GetOutPath()} {GetPlatformAssemblyPaths()} {GetCreateSymbols()}";
|
||||
}
|
||||
|
||||
private string GetCreateSymbols()
|
||||
{
|
||||
var option = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "-createpdb" : "-createperfmap";
|
||||
return $"{option} \"{Path.GetDirectoryName(DestinationPath)}\" \"{DestinationPath}\"";
|
||||
var option = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "--pdb" : "--perfmap";
|
||||
return $"{option}";
|
||||
}
|
||||
|
||||
private string GetDiasymReaderPath()
|
||||
|
@ -174,12 +169,12 @@ namespace Microsoft.DotNet.Build.Tasks
|
|||
|
||||
private string GetInPath()
|
||||
{
|
||||
return $"-in \"{SourceAssembly}\"";
|
||||
return $" \"{SourceAssembly}\"";
|
||||
}
|
||||
|
||||
private string GetOutPath()
|
||||
{
|
||||
return $"-out \"{TempOutputPath}\"";
|
||||
return $"-o \"{TempOutputPath}\"";
|
||||
}
|
||||
|
||||
private string GetPlatformAssemblyPaths()
|
||||
|
@ -190,11 +185,11 @@ namespace Microsoft.DotNet.Build.Tasks
|
|||
{
|
||||
foreach (var excludeTaskItem in PlatformAssemblyPaths)
|
||||
{
|
||||
platformAssemblyPaths += $"{excludeTaskItem.ItemSpec}{Path.PathSeparator}";
|
||||
platformAssemblyPaths += $"-r {excludeTaskItem.ItemSpec}{Path.DirectorySeparatorChar}*.dll ";
|
||||
}
|
||||
}
|
||||
|
||||
return $" -platform_assemblies_paths {platformAssemblyPaths.Trim(':')}";
|
||||
return platformAssemblyPaths;
|
||||
}
|
||||
|
||||
private string GetJitPath()
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<RuntimeNETCoreAppPackageName>microsoft.netcore.app.runtime.$(SharedFrameworkRid)</RuntimeNETCoreAppPackageName>
|
||||
<RuntimeNETCrossgenPackageName>Microsoft.NETCore.App.Crossgen2.$(SharedFrameworkRid)</RuntimeNETCrossgenPackageName>
|
||||
<_crossDir Condition="'$(Architecture)' == 'arm64' and '$(BuildArchitecture)' != 'arm64'">/x64_arm64</_crossDir>
|
||||
<_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'win'">/x86_arm</_crossDir>
|
||||
<_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' != 'win'">/x64_arm</_crossDir>
|
||||
<CrossgenPath>$(NuGetPackageRoot)/$(RuntimeNETCoreAppPackageName)/$(MicrosoftNETCoreAppRuntimePackageVersion)/tools$(_crossDir)/crossgen$(ExeExtension)</CrossgenPath>
|
||||
<CrossgenPath>$(NuGetPackageRoot)/$(RuntimeNETCrossgenPackageName)/$(MicrosoftNETCoreAppRuntimePackageVersion)/tools/crossgen2$(ExeExtension)</CrossgenPath>
|
||||
<LibCLRJitRid Condition="'$(Architecture)' == 'arm64' and '$(BuildArchitecture)' == 'x64'">x64_arm64</LibCLRJitRid>
|
||||
<LibCLRJitRid Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'win'">x86_arm</LibCLRJitRid>
|
||||
<LibCLRJitRid Condition="'$(Architecture)' == 'arm' And '$(OSName)' != 'win'">x64_arm</LibCLRJitRid>
|
||||
|
@ -24,7 +25,7 @@
|
|||
<ItemGroup>
|
||||
<CrossGenDownloadPackageProject Include="$(MSBuildThisFileDirectory)DownloadPackage.csproj">
|
||||
<Properties>
|
||||
PackageToRestore=$(RuntimeNETCoreAppPackageName);
|
||||
PackageToRestore=$(RuntimeNETCrossgenPackageName);
|
||||
PackageVersionToRestore=$(MicrosoftNETCoreAppRuntimePackageVersion);
|
||||
TargetFramework=$(TargetFramework)
|
||||
</Properties>
|
||||
|
|
Loading…
Reference in a new issue