mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
06dea3ab78
Also makes comptime.bat work with git if able. Development builds will now show the branch and the SHA1 hash of the revision. Also been tested to work with subversion, where it displays "Subversion r####". You know, just in case.
30 lines
794 B
Batchfile
30 lines
794 B
Batchfile
@ECHO OFF
|
|
set BRA=Unknown
|
|
set REV=illegal
|
|
|
|
copy nul: /b +%1\comptime.c tmp.$$$ > nul
|
|
move tmp.$$$ %1\comptime.c > nul
|
|
|
|
if exist .git goto gitrev
|
|
if exist .svn goto svnrev
|
|
goto filwri
|
|
|
|
:gitrev
|
|
set GIT=%2
|
|
if "%GIT%"=="" set GIT=git
|
|
FOR /F "usebackq" %%s IN (`%GIT% rev-parse --abbrev-ref HEAD`) DO @SET BRA=%%s
|
|
FOR /F "usebackq" %%s IN (`%GIT% rev-parse HEAD`) DO @SET REV=%%s
|
|
set REV=%REV:~0,8%
|
|
goto filwri
|
|
|
|
:svnrev
|
|
set BRA=Subversion
|
|
FOR /F "usebackq" %%s IN (`svnversion .`) DO @SET REV=%%s
|
|
goto filwri
|
|
|
|
:filwri
|
|
ECHO // Do not edit! This file was autogenerated > %1\comptime.h
|
|
ECHO // by the %0 batch file >> %1\comptime.h
|
|
ECHO // >> %1\comptime.h
|
|
ECHO const char* compbranch = "%BRA%"; >> %1\comptime.h
|
|
ECHO const char* comprevision = "%REV%"; >> %1\comptime.h
|