From f79d430d64f95bda758af077938110b91de41d5f Mon Sep 17 00:00:00 2001 From: nicholas Date: Wed, 15 Mar 2017 17:01:14 +1100 Subject: [PATCH] [Build Script] Add SetGitProperties.cmd --- Source/Script/SetGitProperties.cmd | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Source/Script/SetGitProperties.cmd diff --git a/Source/Script/SetGitProperties.cmd b/Source/Script/SetGitProperties.cmd new file mode 100644 index 000000000..6c7690140 --- /dev/null +++ b/Source/Script/SetGitProperties.cmd @@ -0,0 +1,28 @@ +@echo off +SETLOCAL + +set origdir=%cd% +cd /d %~dp0..\.. +set base_dir=%cd% +cd /d %origdir% + +for /f %%i in ('git describe --tags --long') do set GIT_DESCRIBE=%%i > nul + +for /F "tokens=1,2,3 delims=-" %%i in ("%GIT_DESCRIBE%") do call :process_git_desc %%i %%j %%k +for /F "tokens=1,2,3" %%i in (E:\Android\project64.1\Source\Project64-core\version.h) do call :process_version %%i %%j %%k +set VERSION=v%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%-%VERSION_BUILD%-%VERSION_COMMIT% + +echo GIT_DESCRIBE = %VERSION% > "%base_dir%\git.properties" +goto :EOF + + +:process_git_desc +set VERSION_BUILD=%2 +set VERSION_COMMIT=%3 +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 +goto :EOF