mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
scmversion: Include the current commit hash
This commit is contained in:
parent
64b745fd56
commit
8bc6433be1
|
@ -1,10 +1,11 @@
|
|||
@echo off
|
||||
|
||||
SET VERSIONFILE="scmversion.cpp"
|
||||
FOR /F "tokens=* USEBACKQ" %%g IN (`git rev-parse HEAD`) do (SET "HASH=%%g")
|
||||
FOR /F "tokens=* USEBACKQ" %%g IN (`git rev-parse --abbrev-ref HEAD`) do (SET "BRANCH=%%g")
|
||||
FOR /F "tokens=* USEBACKQ" %%g IN (`git describe --tags --dirty --exclude latest`) do (SET "TAG=%%g")
|
||||
|
||||
SET SIGNATURELINE=// %BRANCH% %TAG%
|
||||
SET SIGNATURELINE=// %HASH% %BRANCH% %TAG%
|
||||
SET /P EXISTINGLINE=< %VERSIONFILE%
|
||||
|
||||
IF "%EXISTINGLINE%"=="%SIGNATURELINE%" (
|
||||
|
@ -15,6 +16,7 @@ IF "%EXISTINGLINE%"=="%SIGNATURELINE%" (
|
|||
ECHO Updating %VERSIONFILE%...
|
||||
|
||||
(ECHO %SIGNATURELINE%
|
||||
ECHO const char* g_scm_hash_str = "%HASH%";
|
||||
ECHO const char* g_scm_branch_str = "%BRANCH%";
|
||||
ECHO const char* g_scm_tag_str = "%TAG%";
|
||||
)>%VERSIONFILE%
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
VERSION_FILE="scmversion.cpp"
|
||||
HASH=$(git rev-parse HEAD)
|
||||
BRANCH=$(git rev-parse --abbrev-ref HEAD | tr -d '\r\n')
|
||||
TAG=$(git describe --tags --dirty --exclude latest | tr -d '\r\n')
|
||||
|
||||
SIGNATURE_LINE="// ${BRANCH} ${TAG}"
|
||||
SIGNATURE_LINE="// ${HASH} ${BRANCH} ${TAG}"
|
||||
|
||||
if [ -f $VERSION_FILE ]; then
|
||||
EXISTING_LINE=$(head -n1 $VERSION_FILE | tr -d '\n')
|
||||
|
@ -18,6 +19,7 @@ echo "Writing ${VERSION_FILE}..."
|
|||
|
||||
cat > $VERSION_FILE << EOF
|
||||
${SIGNATURE_LINE}
|
||||
const char* g_scm_hash_str = "${HASH}";
|
||||
const char* g_scm_branch_str = "${BRANCH}";
|
||||
const char* g_scm_tag_str = "${TAG}";
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
extern const char* g_scm_hash_str;
|
||||
extern const char* g_scm_branch_str;
|
||||
extern const char* g_scm_tag_str;
|
||||
|
||||
|
|
3
src/scmversion/tag.h
Normal file
3
src/scmversion/tag.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
#define SCM_RELEASE_TAG "latest"
|
||||
#define SCM_RELEASE_ASSET "duckstation-windows-x64-release.zip"
|
Loading…
Reference in a new issue