Visual Studio Fix: build even if git is not available

This commit is contained in:
Avi Halachmi (:avih) 2014-04-06 12:58:56 +03:00
parent 0d45e6d70e
commit 2f634bddd3
1 changed files with 10 additions and 8 deletions

View File

@ -21,14 +21,8 @@ IF "%PROGRAMFILES(x86)%" == "" do (
set PATH=%PATH%;"%PROGRAMFILES(x86)%\Git\bin" set PATH=%PATH%;"%PROGRAMFILES(x86)%\Git\bin"
FOR /F "delims=+" %%i IN ('"git show -s --format=%%%ci HEAD"') do ( rem Test if git is available for this repo
set REV3=%%i git show -s
)
set REV2=%REV3: =%
set REV1=%REV2:-=%
set REV=%REV1::=%
if %ERRORLEVEL% NEQ 0 ( if %ERRORLEVEL% NEQ 0 (
echo Automatic version detection unavailable. echo Automatic version detection unavailable.
echo If you want to have the version string print correctly, echo If you want to have the version string print correctly,
@ -41,6 +35,14 @@ if %ERRORLEVEL% NEQ 0 (
echo #define SVN_MODS 0 >> "%CD%\svnrev.h" echo #define SVN_MODS 0 >> "%CD%\svnrev.h"
echo set SVN_REV=0 > "%CD%\postBuild.inc.cmd" echo set SVN_REV=0 > "%CD%\postBuild.inc.cmd"
) else ( ) else (
FOR /F "delims=+" %%i IN ('"git show -s --format=%%%ci HEAD"') do (
set REV3=%%i
)
set REV2=%REV3: =%
set REV1=%REV2:-=%
set REV=%REV1::=%
echo #define SVN_REV %REV%ll > "%CD%\svnrev.h" echo #define SVN_REV %REV%ll > "%CD%\svnrev.h"
echo #define SVN_MODS 0 /* Not implemented at the moment. */ >> "%CD%\svnrev.h" echo #define SVN_MODS 0 /* Not implemented at the moment. */ >> "%CD%\svnrev.h"
echo set SVN_REV=%REV% > "%CD%\postBuild.inc.cmd" echo set SVN_REV=%REV% > "%CD%\postBuild.inc.cmd"