2017-03-15 06:01:14 +00:00
|
|
|
@echo off
|
|
|
|
SETLOCAL
|
|
|
|
|
|
|
|
set origdir=%cd%
|
|
|
|
cd /d %~dp0..\..
|
|
|
|
set base_dir=%cd%
|
|
|
|
cd /d %origdir%
|
|
|
|
|
2021-04-25 10:48:30 +00:00
|
|
|
for /f %%i in ('git rev-parse --short HEAD') do set GIT_REVISION_SHORT=%%i > nul
|
|
|
|
for /f %%i in ('git rev-list --count HEAD') do set GIT_BUILD_VERSION=%%i > nul
|
2017-03-15 06:01:14 +00:00
|
|
|
|
2017-11-15 19:20:17 +00:00
|
|
|
for /F "tokens=1,2,3" %%i in (%base_dir%\Source\Project64-core\version.h.in) do call :process_version %%i %%j %%k
|
2021-04-25 10:48:30 +00:00
|
|
|
set GIT_REVISION_SHORT=%GIT_REVISION_SHORT: =%
|
|
|
|
set GIT_BUILD_VERSION=%GIT_BUILD_VERSION: =%
|
|
|
|
set VERSION=%VERSION_PREFIX%%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%-%GIT_BUILD_VERSION%-%GIT_REVISION_SHORT%
|
2017-03-15 06:01:14 +00:00
|
|
|
|
2019-10-03 04:57:18 +00:00
|
|
|
echo %VERSION%
|
2017-03-15 06:01:14 +00:00
|
|
|
echo GIT_DESCRIBE = %VERSION% > "%base_dir%\git.properties"
|
|
|
|
goto :EOF
|
|
|
|
|
|
|
|
:process_version
|
|
|
|
if "%1" == "#define" if "%2" == "VERSION_MAJOR" set VERSION_MAJOR=%3
|
|
|
|
if "%1" == "#define" if "%2" == "VERSION_MINOR" set VERSION_MINOR=%3
|
|
|
|
if "%1" == "#define" if "%2" == "VERSION_REVISION" set VERSION_REVISION=%3
|
2021-04-25 10:48:30 +00:00
|
|
|
if "%1" == "#define" if "%2" == "VERSION_PREFIX" set VERSION_PREFIX=%~3
|
2017-03-15 06:01:14 +00:00
|
|
|
goto :EOF
|