Skip to content

Commit

Permalink
Support cross CG2 which is not running on helix
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Aug 24, 2024
1 parent fcc3e9f commit 2324602
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/coreclr/tools/r2rtest/Crossgen2Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ class Crossgen2RunnerOptions
class Crossgen2Runner : CompilerRunner
{
private Crossgen2RunnerOptions Crossgen2RunnerOptions;
private bool IsAssembly => _options.Crossgen2Path != null && _options.Crossgen2Path.FullName.EndsWith(".dll");

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

protected override string CompilerPath => _options.Crossgen2Path != null ? _options.Crossgen2Path.FullName : Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "crossgen2.exe" : "crossgen2");
protected override string CompilerPath => IsAssembly ? _options.DotNetCli : _options.Crossgen2Path?.FullName
?? Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "crossgen2.exe" : "crossgen2");

public override CompilerIndex Index => CompilerIndex.CPAOT;

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

// DOTNET_ variables
processParameters.EnvironmentOverrides["DOTNET_GCStress"] = "";
Expand Down
2 changes: 1 addition & 1 deletion src/tests/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@
<CrossgenCmd Condition="'$(__CompositeBuildMode)' == ''">$(CrossgenCmd) --crossgen2-parallelism 1</CrossgenCmd>

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

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

0 comments on commit 2324602

Please sign in to comment.