mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Export a 10-char commit hash in the build version
This avoids collisions in the user report, fixes #7174. Update the user report version to account for the new build version format, fixes #7173. The build version displayed in the GUI is kept at 5 characters for main menu clutter concerns.
This commit is contained in:
@@ -2,5 +2,5 @@
|
|||||||
REM Generate a Unicode string constant from git's output, including branch
|
REM Generate a Unicode string constant from git's output, including branch
|
||||||
REM name and an abbreviated commit hash, and write it to build_version.txt
|
REM name and an abbreviated commit hash, and write it to build_version.txt
|
||||||
FOR /F %%b IN ('git branch --show-current') DO SET branch=%%b
|
FOR /F %%b IN ('git branch --show-current') DO SET branch=%%b
|
||||||
FOR /F %%h IN ('git rev-parse --short^=5 HEAD') DO SET hash=%%h
|
FOR /F %%h IN ('git rev-parse --short HEAD') DO SET hash=%%h
|
||||||
ECHO L"%branch%, %hash%" > build_version.txt
|
ECHO L"%branch%, %hash%" > build_version.txt
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2024 Wildfire Games.
|
/* Copyright (C) 2025 Wildfire Games.
|
||||||
* This file is part of 0 A.D.
|
* This file is part of 0 A.D.
|
||||||
*
|
*
|
||||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||||
@@ -406,7 +406,7 @@ void RunHardwareDetection(bool writeSystemInfoBeforeDetection, Renderer::Backend
|
|||||||
Script::SetProperty(rq, settings, "random_device_entropy", std::random_device{}.entropy());
|
Script::SetProperty(rq, settings, "random_device_entropy", std::random_device{}.entropy());
|
||||||
|
|
||||||
// The version should be increased for every meaningful change.
|
// The version should be increased for every meaningful change.
|
||||||
const int reportVersion = 21;
|
const int reportVersion = 22;
|
||||||
|
|
||||||
// Send the same data to the reporting system
|
// Send the same data to the reporting system
|
||||||
g_UserReporter.SubmitReport(
|
g_UserReporter.SubmitReport(
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2024 Wildfire Games.
|
/* Copyright (C) 2025 Wildfire Games.
|
||||||
* This file is part of 0 A.D.
|
* This file is part of 0 A.D.
|
||||||
*
|
*
|
||||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||||
@@ -80,11 +80,19 @@ double GetBuildTimestamp()
|
|||||||
// hash and cached in lib/build_version.cpp. it is useful to know when attempting
|
// hash and cached in lib/build_version.cpp. it is useful to know when attempting
|
||||||
// to reproduce bugs (the main EXE and PDB should be temporarily reverted to
|
// to reproduce bugs (the main EXE and PDB should be temporarily reverted to
|
||||||
// that commit so that they match user-submitted crashdumps).
|
// that commit so that they match user-submitted crashdumps).
|
||||||
std::wstring GetBuildVersion()
|
// - this function is used by the JS GUI to display the version in a size-constrained
|
||||||
|
// zone. when longerHash is false, the last 5 characters of the git hash are cut off.
|
||||||
|
std::wstring GetBuildVersion(bool longerHash = false)
|
||||||
{
|
{
|
||||||
std::wstring buildVersion(build_version);
|
std::wstring buildVersion(build_version);
|
||||||
if (buildVersion == L"custom build")
|
if (buildVersion == L"custom build")
|
||||||
return wstring_from_utf8(g_L10n.Translate("custom build"));
|
return wstring_from_utf8(g_L10n.Translate("custom build"));
|
||||||
|
|
||||||
|
// The hash is 10-char, which is a bit long for the GUI. Reduce it to 5-char by
|
||||||
|
// default for the main menu display.
|
||||||
|
if (!longerHash && buildVersion.length() > 5)
|
||||||
|
return buildVersion.substr(0, buildVersion.length() - 5);
|
||||||
|
|
||||||
return buildVersion;
|
return buildVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user