2020-04-16 15:56:11 +00:00
|
|
|
@echo off
|
|
|
|
|
|
|
|
SET VERSIONFILE="scmversion.cpp"
|
2020-08-06 10:11:22 +00:00
|
|
|
FOR /F "tokens=* USEBACKQ" %%g IN (`git rev-parse HEAD`) do (SET "HASH=%%g")
|
2020-04-16 15:56:11 +00:00
|
|
|
FOR /F "tokens=* USEBACKQ" %%g IN (`git rev-parse --abbrev-ref HEAD`) do (SET "BRANCH=%%g")
|
2020-12-25 03:58:50 +00:00
|
|
|
FOR /F "tokens=* USEBACKQ" %%g IN (`git describe --tags --dirty --exclude latest --exclude preview`) do (SET "TAG=%%g")
|
2020-08-19 14:43:07 +00:00
|
|
|
FOR /F "tokens=* USEBACKQ" %%g IN (`git log -1 --date=iso8601-strict "--format=%%cd"`) do (SET "CDATE=%%g")
|
2020-04-16 15:56:11 +00:00
|
|
|
|
2020-08-19 14:43:07 +00:00
|
|
|
SET SIGNATURELINE=// %HASH% %BRANCH% %TAG% %CDATE%
|
2020-04-16 15:56:11 +00:00
|
|
|
SET /P EXISTINGLINE=< %VERSIONFILE%
|
|
|
|
|
|
|
|
IF "%EXISTINGLINE%"=="%SIGNATURELINE%" (
|
|
|
|
ECHO Signature matches, skipping writing %VERSIONFILE%
|
|
|
|
EXIT
|
|
|
|
)
|
|
|
|
|
|
|
|
ECHO Updating %VERSIONFILE%...
|
|
|
|
|
|
|
|
(ECHO %SIGNATURELINE%
|
2020-08-06 10:11:22 +00:00
|
|
|
ECHO const char* g_scm_hash_str = "%HASH%";
|
2020-04-16 15:56:11 +00:00
|
|
|
ECHO const char* g_scm_branch_str = "%BRANCH%";
|
|
|
|
ECHO const char* g_scm_tag_str = "%TAG%";
|
2020-08-19 14:43:07 +00:00
|
|
|
ECHO const char* g_scm_date_str = "%CDATE%";
|
2020-04-16 15:56:11 +00:00
|
|
|
)>%VERSIONFILE%
|
|
|
|
|
|
|
|
EXIT
|
|
|
|
|