Skip to content

Commit dae87a5

Browse files
committed
feat(BasicComponent): Adding commit to version
1 parent 5317d8e commit dae87a5

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

AMBuilder

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ for sdk_target in MMSPlugin.sdk_targets:
6767
binary.compiler.linkflags += ['legacy_stdio_definitions.lib', 'legacy_stdio_wide_specifiers.lib']
6868
binary.compiler.defines += ['HAVE_STRUCT_TIMESPEC']
6969

70+
binary.compiler.defines += [
71+
"GITHUB_SHA=\"" + (os.getenv('GITHUB_SHA') == None and "LOCAL" or os.getenv('GITHUB_SHA')) + "\""
72+
]
73+
7074
if binary.compiler.target.platform == 'linux':
7175
binary.compiler.postlink += ['-lrt', '-lssl', '-lcrypto', '-fexceptions', '-lidn2', '-lpsl', '-lbrotlidec', '-lz', '-lbacktrace']
7276
binary.compiler.defines += ["LUA_USE_LINUX", "LUA_USE_READLINE", "BOOST_STACKTRACE_USE_BACKTRACE"]

setup.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
$env:MMSOURCE112 = "$PSScriptRoot\metamod"
22
$env:HL2SDKCS2 = "$PSScriptRoot\hl2sdk"
3+
if (-not $env:GITHUB_SHA) {
4+
$env:GITHUB_SHA = (git rev-parse HEAD)
5+
}
36

47
mkdir build
58
Set-Location build

setup.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
export MMSOURCE112="$(pwd)/metamod"
44
export HL2SDKCS2="$(pwd)/hl2sdk"
55
export HL2SDKMANIFEST="hl2sdk-manifests"
6+
if [ -z "${GITHUB_SHA}" ]; then
7+
export GITHUB_SHA=$(git rev-parse HEAD)
8+
fi
69

710
mkdir build
811
cd build

src/components/BasicComponent/src/BasicComponent.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
#include "../../Plugins/inc/plugins/CPPPlugin.h"
1414
#include "../../Plugins/inc/plugins/LuaPlugin.h"
1515

16+
#ifndef GITHUB_SHA
17+
#define GITHUB_SHA "LOCAL"
18+
#endif
19+
1620
typedef const char *(*GetPlugin)();
1721
typedef double (*GetCount)();
1822

@@ -548,10 +552,11 @@ void SwiftlyAddonsManager(CPlayerSlot *slot, CCommandContext context, const char
548552
void SwiftlyVersion(CPlayerSlot *slot, CCommandContext context)
549553
{
550554
PrintToClientOrConsole(slot, "Version", "Swiftly Version informations:\n");
551-
PrintToClientOrConsole(slot, "Version", " Swiftly Version: %s\n", g_Plugin.GetVersion());
555+
PrintToClientOrConsole(slot, "Version", " Swiftly Version: %s (%s)\n", g_Plugin.GetVersion(), std::string(GITHUB_SHA).substr(0, 7).c_str());
552556
PrintToClientOrConsole(slot, "Version", " Swiftly API Version: %d\n", g_Plugin.GetApiVersion());
553557
PrintToClientOrConsole(slot, "Version", " Swiftly C++ Version: %s\n", GetCppVersion());
554558
PrintToClientOrConsole(slot, "Version", " Compiled on: %s %s\n", __DATE__, __TIME__);
559+
PrintToClientOrConsole(slot, "Version", " Github Commit: https://github.com/swiftly-solution/swiftly/commit/%s\n", std::string(GITHUB_SHA).c_str());
555560
PrintToClientOrConsole(slot, "Version", " https://github.com/swiftly-solution \n");
556561
}
557562

0 commit comments

Comments
 (0)