Define REPO_COMMIT_HASH for singlefilehost - #131441
Open
elinor-fung wants to merge 1 commit into
Open
Conversation
The single-file host statically links the hosting components, which use REPO_COMMIT_HASH (e.g. in 'dotnet --info', hostfxr_get_dotnet_environment_info, and tracing). It is built as part of coreclr, which never passed the commit hash, so configure.h.in hardcoded "static" whenever CLR_SINGLE_FILE_HOST_ONLY was set. Plumb the commit hash into the coreclr native build via SourceRevisionId the same way corehost.proj does for the rest of the host, and always define REPO_COMMIT_HASH from CLI_CMAKE_COMMIT_HASH so singlefilehost reports the real commit (or N/A when source control queries are disabled). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 759b9702-1ed5-4618-a21a-a4d7d9a4d7d5
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the CoreCLR-native build so the statically-linked singlefilehost gets a real repository commit hash (via CMake CLI_CMAKE_COMMIT_HASH) instead of always reporting "static".
Changes:
- Remove the
CLR_SINGLE_FILE_HOST_ONLYpreprocessor special-casing inconfigure.h.insoREPO_COMMIT_HASHalways comes from the CMake-provided commit hash value. - Pass
CLI_CMAKE_COMMIT_HASHinto the CoreCLR native CMake configuration using$(SourceRevisionId)(with a fallback), and ensure source-control info initialization runs when SCM queries are enabled.
Show a summary per file
| File | Description |
|---|---|
| src/native/corehost/configure.h.in | Drops the "static" override so REPO_COMMIT_HASH consistently uses the CMake-substituted commit hash. |
| src/coreclr/runtime.proj | Plumbs SourceRevisionId into CoreCLR’s native CMake args as CLI_CMAKE_COMMIT_HASH and adds SCM initialization to the build dependencies when enabled. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
This was referenced Jul 28, 2026
AaronRobinsonMSFT
approved these changes
Jul 28, 2026
Member
|
@elinor-fung Sorry, this seems like one of those things that a minor tweak in the build system or an errant MSBuild/CMake change could break. Do we want a test for this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
singlefilehost statically links the hosting components, which use
REPO_COMMIT_HASH(indotnet --info,hostfxr_get_dotnet_environment_info, and tracing). Because it's built as part of coreclr, which never passed the commit hash, it always reportedstaticinstead of the real commit.This plumbs the commit hash into the coreclr native build via
SourceRevisionId, the same waycorehost.projdoes for the rest of the host, so singlefilehost now contains the actual version likedotnet/hostfxr/apphost.cc @dotnet/appmodel @AaronRobinsonMSFT
Note
This PR description was drafted with the assistance of GitHub Copilot.