Skip to content

Commit 2324602

Browse files
committed
Support cross CG2 which is not running on helix
1 parent fcc3e9f commit 2324602

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/coreclr/tools/r2rtest/Crossgen2Runner.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ class Crossgen2RunnerOptions
2424
class Crossgen2Runner : CompilerRunner
2525
{
2626
private Crossgen2RunnerOptions Crossgen2RunnerOptions;
27+
private bool IsAssembly => _options.Crossgen2Path != null && _options.Crossgen2Path.FullName.EndsWith(".dll");
2728

2829
// Crossgen2 runs as a standalone binary
2930
protected override string CompilerRelativePath => "";
3031
protected override string CompilerFileName => "";
3132

32-
protected override string CompilerPath => _options.Crossgen2Path != null ? _options.Crossgen2Path.FullName : Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "crossgen2.exe" : "crossgen2");
33+
protected override string CompilerPath => IsAssembly ? _options.DotNetCli : _options.Crossgen2Path?.FullName
34+
?? Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "crossgen2.exe" : "crossgen2");
35+
3336
public override CompilerIndex Index => CompilerIndex.CPAOT;
3437

3538
protected readonly List<string> _referenceFiles = new();
@@ -65,6 +68,8 @@ public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2Run
6568
public override ProcessParameters CompilationProcess(string outputFileName, IEnumerable<string> inputAssemblyFileNames)
6669
{
6770
ProcessParameters processParameters = base.CompilationProcess(outputFileName, inputAssemblyFileNames);
71+
if (IsAssembly)
72+
processParameters.Arguments = $"{_options.Crossgen2Path.FullName} {processParameters.Arguments}";
6873

6974
// DOTNET_ variables
7075
processParameters.EnvironmentOverrides["DOTNET_GCStress"] = "";

src/tests/build.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@
670670
<CrossgenCmd Condition="'$(__CompositeBuildMode)' == ''">$(CrossgenCmd) --crossgen2-parallelism 1</CrossgenCmd>
671671

672672
<CrossgenCmd>$(CrossgenCmd) --verify-type-and-field-layout</CrossgenCmd>
673-
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(CORE_ROOT)\crossgen2\crossgen2$(ExeSuffix)"</CrossgenCmd>
673+
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(__BinDir)\$(BuildArchitecture)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
674674
</PropertyGroup>
675675

676676
<Message Importance="High" Text="$(MsgPrefix)Compiling framework using Crossgen2: $(CrossgenCmd)" />

0 commit comments

Comments
 (0)