Skip to content

Locate crossgen2 by $(CoreCLRConfiguration) in ILCompiler.ReadyToRun.Tests#129548

Open
jtschuster wants to merge 1 commit into
dotnet:mainfrom
jtschuster:jtschuster/r2rtest-crossgen2-coreclr-config
Open

Locate crossgen2 by $(CoreCLRConfiguration) in ILCompiler.ReadyToRun.Tests#129548
jtschuster wants to merge 1 commit into
dotnet:mainfrom
jtschuster:jtschuster/r2rtest-crossgen2-coreclr-config

Conversation

@jtschuster

@jtschuster jtschuster commented Jun 17, 2026

Copy link
Copy Markdown
Member

The ILCompiler.ReadyToRun.Tests project resolved crossgen2 and the copied JIT via $(RuntimeBinDir), which is keyed on the test project's own $(Configuration), while the sibling CoreCLR artifacts it sits next to (System.Private.CoreLib, the JITs) are keyed on $(CoreCLRConfiguration) via $(CoreCLRArtifactsPath). These agree in CI (Configuration=CoreCLRConfiguration) but diverge in dev builds where clr is built in Release, and test is run in the default Debug config.

Align all the crossgen2 config/location on $(CoreCLRConfiguration):

  • The crossgen2_inbuild ProjectReference now sets Configuration to $(CoreCLRConfiguration), so crossgen2 publishes under the CoreCLR config.
  • The wasm JIT copy destination and the R2RTest.Crossgen2Dir runtime option now use $(CoreCLRArtifactsPath) instead of $(RuntimeBinDir).

In CI this is a no-op (Configuration == CoreCLRConfiguration). For dev builds it lets the test find crossgen2 without forcing the test project to be built in the same configuration as CoreCLR.

The ILCompiler.ReadyToRun.Tests project resolved crossgen2 and the copied
wasm JIT via $(RuntimeBinDir), which is keyed on the test project's own
$(Configuration), while the sibling CoreCLR artifacts it sits next to
(System.Private.CoreLib, the JITs) are keyed on $(CoreCLRConfiguration) via
$(CoreCLRArtifactsPath). These agree in CI (where clr-category projects force
Configuration=CoreCLRConfiguration) but diverge in dev builds such as
'clr -rc release' followed by running the test at the default Debug config:
crossgen2 then publishes to / is looked up under the Debug tree while the rest
of the CoreCLR artifacts are under Release, so the test cannot find a working
crossgen2.

Align all three spots that determine the crossgen2 location on
$(CoreCLRConfiguration):
- The crossgen2_inbuild ProjectReference now sets Configuration to
  $(CoreCLRConfiguration) (guarded so it is a no-op when the configs already
  match), mirroring the CoreLib SetConfiguration pattern in
  eng/references.targets, so crossgen2 publishes under the CoreCLR config.
- The wasm JIT copy destination and the R2RTest.Crossgen2Dir runtime option
  now use $(CoreCLRArtifactsPath) instead of $(RuntimeBinDir).

In CI this is a no-op (Configuration == CoreCLRConfiguration). For dev builds
it lets the test find crossgen2 without forcing the test project to be built
in the same configuration as CoreCLR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 17, 2026 23:51
@github-actions github-actions Bot added the area-crossgen2-coreclr only use for closed issues label Jun 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns ILCompiler.ReadyToRun.Tests’s crossgen2 (and wasm JIT copy) location/configuration with CoreCLR build artifacts by keying them off $(CoreCLRConfiguration) / $(CoreCLRArtifactsPath) instead of the test project’s $(Configuration) / $(RuntimeBinDir). This helps developer workflows where CoreCLR is built in one configuration (e.g., Release) while tests are built/run in another (e.g., Debug).

Changes:

  • Sets the crossgen2_inbuild ProjectReference to build/publish using $(CoreCLRConfiguration) via SetConfiguration.
  • Updates the wasm JIT copy destination to use $(CoreCLRArtifactsPath) instead of $(RuntimeBinDir).
  • Updates R2RTest.Crossgen2Dir to point at the CoreCLR artifacts location.

Comment on lines 83 to 85
<RuntimeHostConfigurationOption Include="R2RTest.Crossgen2Dir">
<Value>$(RuntimeBinDir)/$(BuildArchitecture)/crossgen2</Value>
<Value>$(CoreCLRArtifactsPath)/$(BuildArchitecture)/crossgen2</Value>
</RuntimeHostConfigurationOption>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants