Uh oh!
There was an error while loading. Please reload this page.
Show the VMR commit hash in dotnet --info - #99482
Conversation
The VMR defines DotNetGitCommitHash when building runtime. Use that to populate the .version file and corehost's commit hash. That results in showing the VMR's commit hash in the `dotnet --info` output. Contributes to dotnet/source-build#3643
| <_CoreHostUnixTargetOS>$(TargetOS)</_CoreHostUnixTargetOS> | ||
| <_CoreHostUnixTargetOS Condition="'$(TargetsLinuxBionic)' == 'true'">linux-bionic</_CoreHostUnixTargetOS> | ||
| <BuildArgs>$(Configuration) $(TargetArchitecture) -commithash "$([MSBuild]::ValueOrDefault('$(SourceRevisionId)', 'N/A'))" -os $(_CoreHostUnixTargetOS)</BuildArgs> | ||
| <BuildArgs>$(Configuration) $(TargetArchitecture) -commithash "$(CommitHash)" -os $(_CoreHostUnixTargetOS)</BuildArgs> |
There was a problem hiding this comment.
There is another use of SourcerevisionId at later in this file: https://github.com/dotnet/runtime/pull/99482/files#diff-165e4dabf2097f79d2ed18244f5a9762cfc4fe25a69f9be5e8585f61fc871523R146 . Should it get the same treatment?
Would it be better to set SourcerevisionId globally?
There was a problem hiding this comment.
Should it get the same treatment?
I think it should. It does the same thing as this, except for Windows, right? I think we want the Unified Behaviour to be the same: show VMR hash with dotnet --info.
Would it be better to set SourcerevisionId globally?
Probably not. That's used by sourcelink, which we prefer to point to the indvidual repos (though I am not sure why).
@NikolaMilosavljevic , any thoughts?
There was a problem hiding this comment.
I think it should. It does the same thing as this, except for Windows, right?
Yes, same thing, except for Windows. Agree it should have the same behaviour.
AaronRobinsonMSFT
commented
Mar 9, 2024
/cc @elinor-fung |
| <CommitHash Condition="('$(CommitHash)' == '') and ('$(DotNetGitCommitHash)' != '')">$(DotNetGitCommitHash)</CommitHash> | ||
| <CommitHash Condition="('$(CommitHash)' == '') and ('$(SourcerevisionId)' != '')">$(SourceRevisionId)</CommitHash> |
There was a problem hiding this comment.
nit: I find it easier to read when the property just gets set based on being empty and the order indicates the precedence.
| <CommitHashCondition="('$(CommitHash)' == '') and ('$(DotNetGitCommitHash)' != '')">$(DotNetGitCommitHash)</CommitHash> | |
| <CommitHashCondition="('$(CommitHash)' == '') and ('$(SourcerevisionId)' != '')">$(SourceRevisionId)</CommitHash> | |
| <CommitHashCondition="'$(CommitHash)' == ''">$(DotNetGitCommitHash)</CommitHash> | |
| <CommitHashCondition="'$(CommitHash)' == ''">$(SourceRevisionId)</CommitHash> |
Based on the feedback I got at dotnet/installer#18941, I am going to discard this PR. It seems we can get all the benefits of this change without any code changes (and even reduce infra/maintenance). |
The VMR defines DotNetGitCommitHash when building runtime. Use that to populate the .version file and corehost's commit hash. That results in showing the VMR's commit hash in the
dotnet --infooutput.Contributes to dotnet/source-build#3643