Skip to content

Commit

Permalink
[WIN32] fixed: git revision in build setup file name.
Browse files Browse the repository at this point in the history
refactored the git version extraction code to be shared between the update_git_rev.bat and BuildSetup.bat scripts.
  • Loading branch information
CrystalP authored and CrystalP committed Jan 15, 2011
1 parent c67f101 commit f833d1e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 31 deletions.
29 changes: 1 addition & 28 deletions project/VS2010Express/update_git_rev.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,7 @@ IF EXIST %REV_FILE% (
del %REV_FILE%
)

rem Use tgit.exe of TortoiseGit if available
SET GITEXE="tgit.exe"
%GITEXE% --version > NUL 2>&1
if errorlevel 1 goto :notgit
GOTO :extract

:notgit

rem Fallback on msysgit, which must have been added manually to the path.
SET GITEXE="git.exe"
%GITEXE% --help > NUL 2>&1
if errorlevel 1 goto :nogit
GOTO :extract

:nogit

rem Failure - no git tool to extract information.
SET GIT_REV=Unknown
GOTO :extracted

:extract

set oldCurrentDir=%CD%
cd ..\..
FOR /F "tokens=1 delims= " %%A IN ('%GITEXE% rev-parse --short HEAD') DO SET GIT_REV=%%A
cd %oldCurrentDir%

:extracted
CALL ..\Win32BuildSetup\extract_git_rev.bat

copy "%TEMPLATE%" "%REV_FILE%"

Expand Down
7 changes: 4 additions & 3 deletions project/Win32BuildSetup/BuildSetup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,9 @@ IF %comp%==vs2008 (
ECHO Generating installer includes...
call genNsisIncludes.bat
ECHO ------------------------------------------------------------
FOR /F "Tokens=2* Delims=]" %%R IN ('FIND /v /n "&_&_&_&" "..\..\.svn\entries" ^| FIND "[11]"') DO SET XBMC_REV=%%R
SET XBMC_SETUPFILE=XBMCSetup-Rev%XBMC_REV%-%target%.exe
CALL extract_git_rev.bat
SET GIT_REV=#%GIT_REV%
SET XBMC_SETUPFILE=XBMCSetup-Rev%GIT_REV%-%target%.exe
ECHO Creating installer %XBMC_SETUPFILE%...
IF EXIST %XBMC_SETUPFILE% del %XBMC_SETUPFILE% > NUL
rem get path to makensis.exe from registry, first try tab delim
Expand Down Expand Up @@ -260,7 +261,7 @@ IF %comp%==vs2008 (
)

SET NSISExe=%NSISExePath%\makensis.exe
"%NSISExe%" /V1 /X"SetCompressor /FINAL lzma" /Dxbmc_root="%CD%\BUILD_WIN32" /Dxbmc_revision="%XBMC_REV%" /Dxbmc_target="%target%" "XBMC for Windows.nsi"
"%NSISExe%" /V1 /X"SetCompressor /FINAL lzma" /Dxbmc_root="%CD%\BUILD_WIN32" /Dxbmc_revision="%GIT_REV%" /Dxbmc_target="%target%" "XBMC for Windows.nsi"
IF NOT EXIST "%XBMC_SETUPFILE%" (
set DIETEXT=Failed to create %XBMC_SETUPFILE%.
goto DIE
Expand Down
34 changes: 34 additions & 0 deletions project/Win32BuildSetup/extract_git_rev.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@echo off

rem Batch file output: %GIT_REV% variable, containing the git revision

rem Use tgit.exe of TortoiseGit if available
SET GITEXE="tgit.exe"
%GITEXE% --version > NUL 2>&1
if errorlevel 1 goto :notgit
GOTO :extract

:notgit

rem Fallback on msysgit - must be in the path
SET GITEXE="git.exe"
%GITEXE% --help > NUL 2>&1
if errorlevel 1 goto :nogit
GOTO :extract

:nogit

rem Failure - no git tool to extract information.
SET GIT_REV=Unknown
GOTO :done

:extract

set oldCurrentDir=%CD%
cd ..\..
FOR /F "tokens=1 delims= " %%A IN ('%GITEXE% rev-parse --short HEAD') DO SET GIT_REV=%%A
cd %oldCurrentDir%

:done

SET GITEXE=

0 comments on commit f833d1e

Please sign in to comment.