Skip to content

Commit

Permalink
Add tracking of commit hash.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbucchia committed May 26, 2024
1 parent 78d1766 commit 31effa1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ bin/
*.pyc
*.vcxproj.user
*.csproj.user
virtualdesktop-openxr/commit.h
3 changes: 2 additions & 1 deletion virtualdesktop-openxr/instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "trackers.h"
#include "utils.h"
#include "version.h"
#include "commit.h"

namespace {
wil::unique_handle g_fakeHmdConnectedEvent;
Expand All @@ -38,7 +39,7 @@ namespace virtualdesktop_openxr {
using namespace virtualdesktop_openxr::log;

const std::string RuntimePrettyName =
fmt::format(RUNTIME_PRETTY_NAME " - v{}.{}.{}", RuntimeVersionMajor, RuntimeVersionMinor, RuntimeVersionPatch);
fmt::format(RUNTIME_PRETTY_NAME " - v{}.{}.{} ({})", RuntimeVersionMajor, RuntimeVersionMinor, RuntimeVersionPatch, RuntimeCommitHash);

XrResult XRAPI_CALL xrRequestBodyTrackingFidelityMETA(XrBodyTrackerFB bodyTracker,
const XrBodyTrackingFidelityMETA fidelity);
Expand Down
12 changes: 12 additions & 0 deletions virtualdesktop-openxr/virtualdesktop-openxr.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,12 @@ $(SolutionDir)\installer\signtool.exe sign /d "VirtualDesktopXR" /du "https://gi
</PreLinkEvent>
<PreBuildEvent>
<Command>if not exist $(SolutionDir)\version.info goto :skip_version
for /f "tokens=* USEBACKQ" %%F in (`git rev-parse HEAD`) do set commit=%%F
for /f "delims== tokens=1,2" %%G in ($(SolutionDir)\version.info) do set %%G=%%H
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionMajor = .*;$/const unsigned int RuntimeVersionMajor = %major%;/g" $(ProjectDir)\version.h
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionMinor = .*;$/const unsigned int RuntimeVersionMinor = %minor%;/g" $(ProjectDir)\version.h
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionPatch = .*;$/const unsigned int RuntimeVersionPatch = %patch%;/g" $(ProjectDir)\version.h
echo const char* RuntimeCommitHash = "%commit%"; &gt; $(IntDir)\commit.h
..\scripts\sed.exe -i "s/FILEVERSION .*$/FILEVERSION %major%,%minor%,%patch%,0/g" $(ProjectDir)\resource.rc
..\scripts\sed.exe -i "s/PRODUCTVERSION .*$/PRODUCTVERSION %major%,%minor%,%patch%,0/g" $(ProjectDir)\resource.rc
..\scripts\sed.exe -i "s/VALUE \"FileVersion\", \".*\"$/VALUE \"FileVersion\", \"%major%.%minor%.%patch%.0\"/g" $(ProjectDir)\resource.rc
Expand Down Expand Up @@ -247,10 +249,12 @@ $(SolutionDir)\installer\signtool.exe sign /d "VirtualDesktopXR" /du "https://gi
</PreLinkEvent>
<PreBuildEvent>
<Command>if not exist $(SolutionDir)\version.info goto :skip_version
for /f "tokens=* USEBACKQ" %%F in (`git rev-parse HEAD`) do set commit=%%F
for /f "delims== tokens=1,2" %%G in ($(SolutionDir)\version.info) do set %%G=%%H
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionMajor = .*;$/const unsigned int RuntimeVersionMajor = %major%;/g" $(ProjectDir)\version.h
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionMinor = .*;$/const unsigned int RuntimeVersionMinor = %minor%;/g" $(ProjectDir)\version.h
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionPatch = .*;$/const unsigned int RuntimeVersionPatch = %patch%;/g" $(ProjectDir)\version.h
echo const char* RuntimeCommitHash = "%commit%"; &gt; $(IntDir)\commit.h
..\scripts\sed.exe -i "s/FILEVERSION .*$/FILEVERSION %major%,%minor%,%patch%,0/g" $(ProjectDir)\resource.rc
..\scripts\sed.exe -i "s/PRODUCTVERSION .*$/PRODUCTVERSION %major%,%minor%,%patch%,0/g" $(ProjectDir)\resource.rc
..\scripts\sed.exe -i "s/VALUE \"FileVersion\", \".*\"$/VALUE \"FileVersion\", \"%major%.%minor%.%patch%.0\"/g" $(ProjectDir)\resource.rc
Expand Down Expand Up @@ -316,10 +320,12 @@ $(SolutionDir)\installer\signtool.exe sign /d "VirtualDesktopXR" /du "https://gi
</PreLinkEvent>
<PreBuildEvent>
<Command>if not exist $(SolutionDir)\version.info goto :skip_version
for /f "tokens=* USEBACKQ" %%F in (`git rev-parse HEAD`) do set commit=%%F
for /f "delims== tokens=1,2" %%G in ($(SolutionDir)\version.info) do set %%G=%%H
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionMajor = .*;$/const unsigned int RuntimeVersionMajor = %major%;/g" $(ProjectDir)\version.h
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionMinor = .*;$/const unsigned int RuntimeVersionMinor = %minor%;/g" $(ProjectDir)\version.h
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionPatch = .*;$/const unsigned int RuntimeVersionPatch = %patch%;/g" $(ProjectDir)\version.h
echo const char* RuntimeCommitHash = "%commit%"; &gt; $(IntDir)\commit.h
..\scripts\sed.exe -i "s/FILEVERSION .*$/FILEVERSION %major%,%minor%,%patch%,0/g" $(ProjectDir)\resource.rc
..\scripts\sed.exe -i "s/PRODUCTVERSION .*$/PRODUCTVERSION %major%,%minor%,%patch%,0/g" $(ProjectDir)\resource.rc
..\scripts\sed.exe -i "s/VALUE \"FileVersion\", \".*\"$/VALUE \"FileVersion\", \"%major%.%minor%.%patch%.0\"/g" $(ProjectDir)\resource.rc
Expand Down Expand Up @@ -385,10 +391,12 @@ $(SolutionDir)\installer\signtool.exe sign /d "VirtualDesktopXR" /du "https://gi
</PreLinkEvent>
<PreBuildEvent>
<Command>if not exist $(SolutionDir)\version.info goto :skip_version
for /f "tokens=* USEBACKQ" %%F in (`git rev-parse HEAD`) do set commit=%%F
for /f "delims== tokens=1,2" %%G in ($(SolutionDir)\version.info) do set %%G=%%H
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionMajor = .*;$/const unsigned int RuntimeVersionMajor = %major%;/g" $(ProjectDir)\version.h
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionMinor = .*;$/const unsigned int RuntimeVersionMinor = %minor%;/g" $(ProjectDir)\version.h
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionPatch = .*;$/const unsigned int RuntimeVersionPatch = %patch%;/g" $(ProjectDir)\version.h
echo const char* RuntimeCommitHash = "%commit%"; &gt; $(IntDir)\commit.h
..\scripts\sed.exe -i "s/FILEVERSION .*$/FILEVERSION %major%,%minor%,%patch%,0/g" $(ProjectDir)\resource.rc
..\scripts\sed.exe -i "s/PRODUCTVERSION .*$/PRODUCTVERSION %major%,%minor%,%patch%,0/g" $(ProjectDir)\resource.rc
..\scripts\sed.exe -i "s/VALUE \"FileVersion\", \".*\"$/VALUE \"FileVersion\", \"%major%.%minor%.%patch%.0\"/g" $(ProjectDir)\resource.rc
Expand Down Expand Up @@ -454,10 +462,12 @@ $(SolutionDir)\installer\signtool.exe sign /d "VirtualDesktopXR" /du "https://gi
</PreLinkEvent>
<PreBuildEvent>
<Command>if not exist $(SolutionDir)\version.info goto :skip_version
for /f "tokens=* USEBACKQ" %%F in (`git rev-parse HEAD`) do set commit=%%F
for /f "delims== tokens=1,2" %%G in ($(SolutionDir)\version.info) do set %%G=%%H
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionMajor = .*;$/const unsigned int RuntimeVersionMajor = %major%;/g" $(ProjectDir)\version.h
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionMinor = .*;$/const unsigned int RuntimeVersionMinor = %minor%;/g" $(ProjectDir)\version.h
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionPatch = .*;$/const unsigned int RuntimeVersionPatch = %patch%;/g" $(ProjectDir)\version.h
echo const char* RuntimeCommitHash = "%commit%"; &gt; $(IntDir)\commit.h
..\scripts\sed.exe -i "s/FILEVERSION .*$/FILEVERSION %major%,%minor%,%patch%,0/g" $(ProjectDir)\resource.rc
..\scripts\sed.exe -i "s/PRODUCTVERSION .*$/PRODUCTVERSION %major%,%minor%,%patch%,0/g" $(ProjectDir)\resource.rc
..\scripts\sed.exe -i "s/VALUE \"FileVersion\", \".*\"$/VALUE \"FileVersion\", \"%major%.%minor%.%patch%.0\"/g" $(ProjectDir)\resource.rc
Expand Down Expand Up @@ -523,10 +533,12 @@ $(SolutionDir)\installer\signtool.exe sign /d "VirtualDesktopXR" /du "https://gi
</PreLinkEvent>
<PreBuildEvent>
<Command>if not exist $(SolutionDir)\version.info goto :skip_version
for /f "tokens=* USEBACKQ" %%F in (`git rev-parse HEAD`) do set commit=%%F
for /f "delims== tokens=1,2" %%G in ($(SolutionDir)\version.info) do set %%G=%%H
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionMajor = .*;$/const unsigned int RuntimeVersionMajor = %major%;/g" $(ProjectDir)\version.h
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionMinor = .*;$/const unsigned int RuntimeVersionMinor = %minor%;/g" $(ProjectDir)\version.h
..\scripts\sed.exe -i "s/const unsigned int RuntimeVersionPatch = .*;$/const unsigned int RuntimeVersionPatch = %patch%;/g" $(ProjectDir)\version.h
echo const char* RuntimeCommitHash = "%commit%"; &gt; $(IntDir)\commit.h
..\scripts\sed.exe -i "s/FILEVERSION .*$/FILEVERSION %major%,%minor%,%patch%,0/g" $(ProjectDir)\resource.rc
..\scripts\sed.exe -i "s/PRODUCTVERSION .*$/PRODUCTVERSION %major%,%minor%,%patch%,0/g" $(ProjectDir)\resource.rc
..\scripts\sed.exe -i "s/VALUE \"FileVersion\", \".*\"$/VALUE \"FileVersion\", \"%major%.%minor%.%patch%.0\"/g" $(ProjectDir)\resource.rc
Expand Down

0 comments on commit 31effa1

Please sign in to comment.