aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-10-04 10:49:16 +0200
committerGitHub <[email protected]>2021-10-04 10:49:16 +0200
commit0a393c8d0b3375750975fde879c975a82fd0b1cf (patch)
treef50e12c618609045baf5822872ecb503693f2f80
parenthttp: Moved logic for body suppression to a more central location (diff)
downloadzen-0a393c8d0b3375750975fde879c975a82fd0b1cf.tar.xz
zen-0a393c8d0b3375750975fde879c975a82fd0b1cf.zip
Added build version tag using the latest Git commit hash. (#16)
build: Added build version tag using the latest Git commit hash an date/time
-rw-r--r--zenserver/xmake.lua15
-rw-r--r--zenserver/zenserver.cpp9
2 files changed, 21 insertions, 3 deletions
diff --git a/zenserver/xmake.lua b/zenserver/xmake.lua
index 7a6981fcd..fb1ba651d 100644
--- a/zenserver/xmake.lua
+++ b/zenserver/xmake.lua
@@ -32,3 +32,18 @@ target("zenserver")
add_packages(
"vcpkg::cxxopts",
"vcpkg::mimalloc")
+
+ on_load(function(target)
+ local commit, err = os.iorun("git log -1 --format=\"%h-%cI\"")
+ if commit ~= nil then
+ commit = commit:gsub("%s+", "")
+ commit = commit:gsub("\n", "")
+ if is_mode("release") then
+ commit = "rel-" .. commit
+ else
+ commit = "dbg-" .. commit
+ end
+ target:add("defines","BUILD_VERSION=\"" .. commit .. "\"")
+ print("build version " .. commit)
+ end
+ end)
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index f9b4d5677..f5d8364cb 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -31,6 +31,10 @@
#include <set>
#include <unordered_map>
+#if !defined(BUILD_VERSION)
+#define BUILD_VERSION ("DEV-BUILD")
+#endif
+
//////////////////////////////////////////////////////////////////////////
// We don't have any doctest code in this file but this is needed to bring
// in some shared code into the executable
@@ -103,10 +107,9 @@ class ZenServer
public:
void Initialize(ZenServiceConfig& ServiceConfig, int BasePort, int ParentPid, ZenServerState::ZenServerEntry* ServerEntry)
{
- m_ServerEntry = ServerEntry;
using namespace fmt::literals;
- ZEN_INFO(ZEN_APP_NAME " initializing");
+ m_ServerEntry = ServerEntry;
m_DebugOptionForcedCrash = ServiceConfig.ShouldCrash;
if (ParentPid)
@@ -532,7 +535,7 @@ ZenWindowsService::Run()
ParseServiceConfig(GlobalOptions.DataDir, /* out */ ServiceConfig);
- ZEN_INFO("zen cache server starting on port {}", GlobalOptions.BasePort);
+ ZEN_INFO(ZEN_APP_NAME " - starting on port {}, build '{}'", GlobalOptions.BasePort, BUILD_VERSION);
ZenServerState ServerState;
ServerState.Initialize();