Add GitRevision

GitRevision as in TrinityCore
This commit is contained in:
Kargatum
2018-06-05 19:39:36 +07:00
committed by Barbz
parent 52fa2c2967
commit 7329ad4790
9 changed files with 95 additions and 47 deletions

View File

@@ -20,7 +20,7 @@
#include "WheatyExceptionReport.h" #include "WheatyExceptionReport.h"
#include "Common.h" #include "Common.h"
#include "SystemConfig.h" #include "GitRevision.h"
#include "revision.h" #include "revision.h"
#define CrashFolder _T("Crashes") #define CrashFolder _T("Crashes")
@@ -422,7 +422,7 @@ PEXCEPTION_POINTERS pExceptionInfo)
GetLocalTime(&systime); GetLocalTime(&systime);
// Start out with a banner // Start out with a banner
_tprintf(_T("Revision: %s\r\n"), _FULLVERSION); _tprintf(_T("Revision: %s\r\n"), GitRevision::GetFullVersion());
_tprintf(_T("Date %u:%u:%u. Time %u:%u \r\n"), systime.wDay, systime.wMonth, systime.wYear, systime.wHour, systime.wMinute); _tprintf(_T("Date %u:%u:%u. Time %u:%u \r\n"), systime.wDay, systime.wMonth, systime.wYear, systime.wHour, systime.wMinute);
PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord; PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord;

View File

@@ -0,0 +1,57 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*/
#include "GitRevision.h"
#include "revision.h"
char const* GitRevision::GetHash()
{
return _HASH;
}
char const* GitRevision::GetDate()
{
return _DATE;
}
char const* GitRevision::GetBranch()
{
return _BRANCH;
}
#if PLATFORM == PLATFORM_WINDOWS
# ifdef _WIN64
# define AZEROTH_PLATFORM_STR "Win64"
# else
# define AZEROTH_PLATFORM_STR "Win32"
# endif
#else // PLATFORM
# define AZEROTH_PLATFORM_STR "Unix"
#endif
char const* GitRevision::GetFullVersion()
{
return VER_COMPANYNAME_STR " rev. " VER_PRODUCTVERSION_STR " (" AZEROTH_PLATFORM_STR ", " _BUILD_DIRECTIVE ")";
}
char const* GitRevision::GetCompanyNameStr()
{
return VER_COMPANYNAME_STR;
}
char const* GitRevision::GetLegalCopyrightStr()
{
return VER_LEGALCOPYRIGHT_STR;
}
char const* GitRevision::GetFileVersionStr()
{
return VER_FILEVERSION_STR;
}
char const* GitRevision::GetProductVersionStr()
{
return VER_PRODUCTVERSION_STR;
}

23
src/common/GitRevision.h Normal file
View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2018 TrinityCore <http://www.trinitycore.org/>
*/
#ifndef __GITREVISION_H__
#define __GITREVISION_H__
#include "Define.h"
namespace GitRevision
{
char const* GetHash();
char const* GetDate();
char const* GetBranch();
char const* GetFullVersion();
char const* GetCompanyNameStr();
char const* GetLegalCopyrightStr();
char const* GetFileVersionStr();
char const* GetProductVersionStr();
}
#endif

View File

@@ -1,32 +0,0 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
// THIS FILE IS DEPRECATED
#ifndef TRINITY_SYSTEMCONFIG_H
#define TRINITY_SYSTEMCONFIG_H
#include "Define.h"
#include "revision.h"
#define _PACKAGENAME "AzerothCore"
#if TRINITY_ENDIAN == TRINITY_BIGENDIAN
# define _ENDIAN_STRING "big-endian"
#else
# define _ENDIAN_STRING "little-endian"
#endif
#if PLATFORM == PLATFORM_WINDOWS
# ifdef _WIN64
# define _FULLVERSION _PACKAGENAME " rev. " VER_PRODUCTVERSION_STR " (Win64, " _BUILD_DIRECTIVE ")"
# else
# define _FULLVERSION _PACKAGENAME " rev. " VER_PRODUCTVERSION_STR " (Win32, " _BUILD_DIRECTIVE ")"
# endif
#else
# define _FULLVERSION _PACKAGENAME " rev. " VER_PRODUCTVERSION_STR " (Unix, " _BUILD_DIRECTIVE ")"
#endif
#endif

View File

@@ -23,7 +23,7 @@
#include "Database/DatabaseEnv.h" #include "Database/DatabaseEnv.h"
#include "Configuration/Config.h" #include "Configuration/Config.h"
#include "Log.h" #include "Log.h"
#include "SystemConfig.h" #include "GitRevision.h"
#include "Util.h" #include "Util.h"
#include "SignalHandler.h" #include "SignalHandler.h"
#include "RealmList.h" #include "RealmList.h"
@@ -106,7 +106,7 @@ extern int main(int argc, char** argv)
printf("Verify that the file exists and has \'[authserver]\' written in the top of the file!\n"); printf("Verify that the file exists and has \'[authserver]\' written in the top of the file!\n");
} }
sLog->outString("%s (authserver)", _FULLVERSION); sLog->outString("%s (authserver)", GitRevision::GetFullVersion());
sLog->outString("<Ctrl-C> to stop.\n"); sLog->outString("<Ctrl-C> to stop.\n");
sLog->outString(" █████╗ ███████╗███████╗██████╗ ██████╗ ████████╗██╗ ██╗"); sLog->outString(" █████╗ ███████╗███████╗██████╗ ██████╗ ████████╗██╗ ██╗");

View File

@@ -31,7 +31,7 @@
#include "SocialMgr.h" #include "SocialMgr.h"
#include "SpellAuras.h" #include "SpellAuras.h"
#include "SpellAuraEffects.h" #include "SpellAuraEffects.h"
#include "SystemConfig.h" #include "GitRevision.h"
#include "UpdateMask.h" #include "UpdateMask.h"
#include "Util.h" #include "Util.h"
#include "World.h" #include "World.h"
@@ -933,7 +933,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
// send server info // send server info
if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1) if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
chH.PSendSysMessage(_FULLVERSION); chH.PSendSysMessage("%s", GitRevision::GetFullVersion());
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("WORLD: Sent server info"); sLog->outStaticDebug("WORLD: Sent server info");
@@ -1235,7 +1235,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
// send server info // send server info
if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1) if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
chH.PSendSysMessage(_FULLVERSION); chH.PSendSysMessage("%s", GitRevision::GetFullVersion());
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("WORLD: Sent server info"); sLog->outStaticDebug("WORLD: Sent server info");

View File

@@ -11,7 +11,7 @@
#include "Common.h" #include "Common.h"
#include "DatabaseEnv.h" #include "DatabaseEnv.h"
#include "Config.h" #include "Config.h"
#include "SystemConfig.h" #include "GitRevision.h"
#include "Log.h" #include "Log.h"
#include "Opcodes.h" #include "Opcodes.h"
#include "WorldSession.h" #include "WorldSession.h"
@@ -1782,7 +1782,7 @@ void World::SetInitialWorldSettings()
m_startTime = m_gameTime; m_startTime = m_gameTime;
LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES(%u, %u, 0, '%s')", LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES(%u, %u, 0, '%s')",
realmID, uint32(m_startTime), _FULLVERSION); // One-time query realmID, uint32(m_startTime), GitRevision::GetFullVersion()); // One-time query

View File

@@ -17,7 +17,7 @@ EndScriptData */
#include "ObjectAccessor.h" #include "ObjectAccessor.h"
#include "Player.h" #include "Player.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "SystemConfig.h" #include "GitRevision.h"
#include "AvgDiffTracker.h" #include "AvgDiffTracker.h"
class server_commandscript : public CommandScript class server_commandscript : public CommandScript
@@ -99,7 +99,7 @@ public:
uint32 updateTime = sWorld->GetUpdateTime(); uint32 updateTime = sWorld->GetUpdateTime();
uint32 avgUpdateTime = avgDiffTracker.getAverage(); uint32 avgUpdateTime = avgDiffTracker.getAverage();
handler->PSendSysMessage("%s", _FULLVERSION); handler->PSendSysMessage("%s", GitRevision::GetFullVersion());
if (!queuedSessionCount) if (!queuedSessionCount)
handler->PSendSysMessage("Connected players: %u. Characters in world: %u.", activeSessionCount, playerCount); handler->PSendSysMessage("Connected players: %u. Characters in world: %u.", activeSessionCount, playerCount);
else else

View File

@@ -11,7 +11,7 @@
#include <ace/Sig_Handler.h> #include <ace/Sig_Handler.h>
#include "Common.h" #include "Common.h"
#include "SystemConfig.h" #include "GitRevision.h"
#include "SignalHandler.h" #include "SignalHandler.h"
#include "World.h" #include "World.h"
#include "WorldRunnable.h" #include "WorldRunnable.h"
@@ -115,7 +115,7 @@ int Master::Run()
BigNumber seed1; BigNumber seed1;
seed1.SetRand(16 * 8); seed1.SetRand(16 * 8);
sLog->outString("%s (worldserver-daemon)", _FULLVERSION); sLog->outString("%s (worldserver-daemon)", GitRevision::GetFullVersion());
sLog->outString("<Ctrl-C> to stop.\n"); sLog->outString("<Ctrl-C> to stop.\n");
sLog->outString(" █████╗ ███████╗███████╗██████╗ ██████╗ ████████╗██╗ ██╗"); sLog->outString(" █████╗ ███████╗███████╗██████╗ ██████╗ ████████╗██╗ ██╗");
@@ -295,7 +295,7 @@ int Master::Run()
// set server online (allow connecting now) // set server online (allow connecting now)
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID); LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID);
sLog->outString("%s (worldserver-daemon) ready...", _FULLVERSION); sLog->outString("%s (worldserver-daemon) ready...", GitRevision::GetFullVersion());
// when the main thread closes the singletons get unloaded // when the main thread closes the singletons get unloaded
// since worldrunnable uses them, it will crash if unloaded after master // since worldrunnable uses them, it will crash if unloaded after master
@@ -482,7 +482,7 @@ bool Master::_StartDB()
ClearOnlineAccounts(); ClearOnlineAccounts();
///- Insert version info into DB ///- Insert version info into DB
WorldDatabase.PExecute("UPDATE version SET core_version = '%s', core_revision = '%s'", _FULLVERSION, _HASH); // One-time query WorldDatabase.PExecute("UPDATE version SET core_version = '%s', core_revision = '%s'", GitRevision::GetFullVersion(), GitRevision::GetHash()); // One-time query
sWorld->LoadDBVersion(); sWorld->LoadDBVersion();