aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrystalP <CrystalP@xbmc.org>2011-01-09 01:45:26 -0500
committerCrystalP <CrystalP@xbmc.org>2011-01-09 21:30:52 -0500
commit7a00cc25f12c295dc5ed8326c66c8c4b7f32ba96 (patch)
tree4b3351ff856fab55528ca5716b8617633af1ff16
parent8a9b3f464d06cccf4480ce9a1c0a7f13155e2089 (diff)
[WIN32] extract git rev number
-rw-r--r--.gitignore2
-rw-r--r--project/VS2010Express/guilib.vcxproj9
-rw-r--r--project/VS2010Express/update_git_rev.bat40
-rw-r--r--project/VS2010Express/update_svn_rev.bat46
-rw-r--r--project/Win32BuildSetup/GetSvnInfo.bat12
-rw-r--r--xbmc/win32/PlatformInclude.h6
-rw-r--r--xbmc/win32/git_rev.tmpl (renamed from xbmc/win32/svn_rev_git.tmpl)9
-rw-r--r--xbmc/win32/svn_rev.tmpl29
8 files changed, 54 insertions, 99 deletions
diff --git a/.gitignore b/.gitignore
index 6478bbb0da..4eb57c5e5c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1213,4 +1213,4 @@ config.log
/xbmc/visualizations/XBMCProjectM/libprojectM/cmake_install.cmake
/xbmc/visualizations/XBMCProjectM/libprojectM/config.inp
-/xbmc/win32/svn_rev.h
+/xbmc/win32/git_rev.h
diff --git a/project/VS2010Express/guilib.vcxproj b/project/VS2010Express/guilib.vcxproj
index 586a9b9913..422457d6a9 100644
--- a/project/VS2010Express/guilib.vcxproj
+++ b/project/VS2010Express/guilib.vcxproj
@@ -409,10 +409,13 @@
<ClInclude Include="..\..\guilib\LocalizeStrings.h" />
<ClInclude Include="..\..\xbmc\win32\pch.h" />
<CustomBuild Include="..\..\xbmc\win32\PlatformInclude.h">
- <Command Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">update_svn_rev.bat
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">update_git_rev.bat
</Command>
- <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">..\..\svn\entries;%(AdditionalInputs)</AdditionalInputs>
- <Outputs Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">..\..\xbmc\win32\svn_rev.h;%(Outputs)</Outputs>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">..\..\.git\HEAD;..\..\xbmc\win32\git_rev.tmpl</AdditionalInputs>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">..\..\xbmc\win32\git_rev.h;%(Outputs)</Outputs>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release (OpenGL)|Win32'">update_git_rev.bat</Command>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Release (OpenGL)|Win32'">..\..\xbmc\win32\git_rev.h;%(Outputs)</Outputs>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release (OpenGL)|Win32'">..\..\.git\HEAD;..\..\xbmc\win32\git_rev.tmpl</AdditionalInputs>
</CustomBuild>
<ClInclude Include="..\..\guilib\Shader.h" />
<ClInclude Include="..\..\guilib\StdString.h" />
diff --git a/project/VS2010Express/update_git_rev.bat b/project/VS2010Express/update_git_rev.bat
new file mode 100644
index 0000000000..869a15815f
--- /dev/null
+++ b/project/VS2010Express/update_git_rev.bat
@@ -0,0 +1,40 @@
+@echo off
+
+SET TEMPLATE=..\..\xbmc\win32\git_rev.tmpl
+SET REV_FILE=..\..\xbmc\win32\git_rev.h
+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
+
+copy "%TEMPLATE%" "%REV_FILE%"
+
+echo #define GIT_REV "%GIT_REV%" >> %REV_FILE%
diff --git a/project/VS2010Express/update_svn_rev.bat b/project/VS2010Express/update_svn_rev.bat
deleted file mode 100644
index 707f9fef37..0000000000
--- a/project/VS2010Express/update_svn_rev.bat
+++ /dev/null
@@ -1,46 +0,0 @@
-@echo off
-rem subwcrev is included in the tortoise svn client: http://tortoisesvn.net/downloads
-SET REV_FILE=..\..\xbmc\win32\svn_rev.h
-IF EXIST %REV_FILE% (
- del %REV_FILE%
-)
-
-IF EXIST "..\..\.svn" (
- subwcrev ../.. ../../xbmc/win32/svn_rev.tmpl %REV_FILE%
- goto :eof
-)
-
-SetLocal EnableDelayedExpansion
-
-set oldCurrentDir=%CD%
-IF EXIST "..\..\.git" (
- cd ..\..
- FOR /F "delims=: skip=8 tokens=2*" %%a IN ('git svn info') DO (call :set_var %%a %%b)
-)
-chdir /d %oldCurrentDir%
-
-copy "..\..\xbmc\win32\svn_rev_git.tmpl" "%REV_FILE%"
-
-if "%REV%"=="" set REV=Unknown
-if "%REV_DATE%"=="" set REV_DATE=Unknown
-
-echo #define SVN_REV "%REV%" >> %REV_FILE%
-echo #define SVN_DATE "%REV_DATE%" >> %REV_FILE%
-
-echo #endif >> %REV_FILE%
-
-goto :eof
-
-:set_var
-IF "%REV%"=="" (
- SET REV=%1
-) ELSE IF "%REV_DATE%"=="" (
- call :set_var_2 %1 %2 %3 %4 %5 %6 %7 %8
-)
-goto :eof
-
-:set_var_2
-SET REV_DATE=%1 %2:%3 %4 %5, %6 %7 %8^)
-goto :eof
-
-:eof \ No newline at end of file
diff --git a/project/Win32BuildSetup/GetSvnInfo.bat b/project/Win32BuildSetup/GetSvnInfo.bat
deleted file mode 100644
index daf9935376..0000000000
--- a/project/Win32BuildSetup/GetSvnInfo.bat
+++ /dev/null
@@ -1,12 +0,0 @@
-@ECHO OFF
-SET target=none
-FOR %%b in (%1, %2) DO (
- IF %%b==revision SET target=revision
- IF %%b==branch SET target=branch
-)
-
-IF %target%==branch (
- FOR /f "tokens=2* delims=]" %%a in ('find /v /n "&_&_&_&" ".svn\entries" ^| FIND "[5]"') DO ECHO %%~NaXa
-) ELSE (
- IF %target%==revision (FOR /F "Tokens=2* Delims=]" %%R IN ('FIND /v /n "&_&_&_&" ".svn\entries" ^| FIND "[11]"') DO ECHO %%R)
-)
diff --git a/xbmc/win32/PlatformInclude.h b/xbmc/win32/PlatformInclude.h
index c61f23a68e..3c045509ee 100644
--- a/xbmc/win32/PlatformInclude.h
+++ b/xbmc/win32/PlatformInclude.h
@@ -22,9 +22,9 @@
*
*/
-//#if !defined(_DEBUG) && _MSC_VER >= 1500
-//#include "svn_rev.h" //generated file
-//#endif
+#if !defined(_DEBUG) && _MSC_VER >= 1500
+#include "git_rev.h" //generated file
+#endif
#include <errno.h> // for ENOENT and EINVAL
#include "PlatformDefs.h"
diff --git a/xbmc/win32/svn_rev_git.tmpl b/xbmc/win32/git_rev.tmpl
index 7b3feb8ffc..4d2c8aba3e 100644
--- a/xbmc/win32/svn_rev_git.tmpl
+++ b/xbmc/win32/git_rev.tmpl
@@ -1,8 +1,5 @@
-#ifndef __SVN_REV__H__
-#define __SVN_REV__H__
-
/*
- * Copyright (C) 2005-2008 Team XBMC
+ * Copyright (C) 2011 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
@@ -22,5 +19,7 @@
*
*/
-#undef SVN_REV
+#pragma once
+
+#undef GIT_REV
diff --git a/xbmc/win32/svn_rev.tmpl b/xbmc/win32/svn_rev.tmpl
deleted file mode 100644
index 46e9c704c8..0000000000
--- a/xbmc/win32/svn_rev.tmpl
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __SVN_REV__H__
-#define __SVN_REV__H__
-
-/*
- * Copyright (C) 2005-2008 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#undef SVN_REV
-#define SVN_REV "$WCREV$"
-#define SVN_DATE "$WCDATE$"
-
-#endif