Skip to content

Commit

Permalink
replace git revision with tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Razish committed Feb 29, 2024
1 parent 6407f98 commit 0fc80d4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 28 deletions.
24 changes: 8 additions & 16 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,13 @@ def get_compiler_version():
ccversion = get_compiler_version()


# git revision
# TODO: consider tags
def get_git_revision():
cmd_status, rawrevision = run_command("git rev-parse --short HEAD")
git_revision = None if cmd_status else rawrevision
# git tag
def get_git_tag():
cmd_status, rawtag = run_command("git describe --tags --exclude=latest")
return None if cmd_status else rawtag

if git_revision:
cmd_status, _ = run_command("git diff-index --quiet HEAD")
if cmd_status:
git_revision += "*"

return git_revision


revision = get_git_revision()
git_tag = get_git_tag()


# set job/thread count
Expand Down Expand Up @@ -215,7 +207,7 @@ env.SetOption("num_jobs", GetNumCores())
# notify the user of the build configuration
if not env.GetOption("clean"):
# build tools
msg = "Building " + ((revision + " ") if revision else "")
msg = "Building " + ((git_tag + " ") if git_tag else "")
msg += (
"using "
+ str(env.GetOption("num_jobs"))
Expand Down Expand Up @@ -652,8 +644,8 @@ if debug:
"_DEBUG",
]

if revision:
env["CPPDEFINES"] += ['REVISION=\\"' + revision + '\\"']
if git_tag:
env["CPPDEFINES"] += ['GIT_TAG=\\"' + git_tag + '\\"']

# override options
if target_plat != "Linux":
Expand Down
6 changes: 3 additions & 3 deletions cgame/cg_jappScoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,10 +1131,10 @@ static void DrawClientInfo(float fade) {
y -= font.Height(buf);
font.Paint(SCREEN_WIDTH - font.Width(buf), y, buf, &colour, uiTextStyle_e::ShadowedMore);

#ifdef REVISION
y -= font.Height(REVISION);
#ifdef GIT_TAG
y -= font.Height(GIT_TAG);
// JA++ version
font.Paint(SCREEN_WIDTH - font.Width(REVISION), y, REVISION, &colour, uiTextStyle_e::ShadowedMore);
font.Paint(SCREEN_WIDTH - font.Width(GIT_TAG), y, GIT_TAG, &colour, uiTextStyle_e::ShadowedMore);
#endif
}

Expand Down
6 changes: 3 additions & 3 deletions cgame/cg_q3pScoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,10 +800,10 @@ static void DrawClientInfo(float fade) {
VectorCopy4(&g_color_table[ColorIndex(COLOR_ORANGE)], &colour);
colour.a = fade;

#ifdef REVISION
y -= font.Height(REVISION);
#ifdef GIT_TAG
y -= font.Height(GIT_TAG);
// JA++ version
font.Paint(SCREEN_WIDTH - font.Width(REVISION), y, REVISION, &colour, uiTextStyle_e::ShadowedMore);
font.Paint(SCREEN_WIDTH - font.Width(GIT_TAG), y, GIT_TAG, &colour, uiTextStyle_e::ShadowedMore);
#endif

// date
Expand Down
12 changes: 6 additions & 6 deletions qcommon/q_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ typedef int32_t qhandle_t, fxHandle_t, sfxHandle_t, fileHandle_t, clipHandle_t;

// ja++ version
#define JAPP_VERSION_SMALL "JA++, " XSTRING(ARCH_WIDTH) " bits, " __DATE__
#ifdef REVISION
#define JAPP_VERSION JAPP_VERSION_SMALL ", " REVISION
#ifdef GIT_TAG
#define JAPP_VERSION JAPP_VERSION_SMALL ", " GIT_TAG
#else
#define JAPP_VERSION JAPP_VERSION_SMALL
#endif
Expand Down Expand Up @@ -765,7 +765,7 @@ extern vector3 axisDefault[3];
float Q_fabs(float f);
float Q_rsqrt(float f); // reciprocal square root

#define SQRTFAST(x) ((x) * Q_rsqrt(x))
#define SQRTFAST(x) ((x)*Q_rsqrt(x))

signed char ClampChar(int i);
signed short ClampShort(int i);
Expand All @@ -782,8 +782,8 @@ void ByteToDir(int b, vector3 *dir);

#define Square(x) ((x) * (x))

#define DEG2RAD(a) (((a) * M_PI) / 180.0F)
#define RAD2DEG(a) (((a) * 180.0f) / M_PI)
#define DEG2RAD(a) (((a)*M_PI) / 180.0F)
#define RAD2DEG(a) (((a)*180.0f) / M_PI)

void VectorAdd(const vector3 *vec1, const vector3 *vec2, vector3 *vecOut);
void VectorSubtract(const vector3 *vec1, const vector3 *vec2, vector3 *vecOut);
Expand Down Expand Up @@ -1154,7 +1154,7 @@ typedef enum soundChannel_e {
CHAN_MUSIC, // ## %s !!"W:\game\base\!!sound\*.wav;*.mp3" #music played as a looping sound - added by BTO (VV)
} soundChannel_t;

#define ANGLE2SHORT(x) ((int)((x) * 65536 / 360) & 65535)
#define ANGLE2SHORT(x) ((int)((x)*65536 / 360) & 65535)
#define SHORT2ANGLE(x) ((x) * (360.0f / 65536))

#define SNAPFLAG_RATE_DELAYED 1
Expand Down

0 comments on commit 0fc80d4

Please sign in to comment.