make generation of svnrev.h slightly more sane, by using vbscript instead of just batch script.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5932 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2010-07-22 02:46:11 +00:00
parent 3859a7dce2
commit b4ce9c90b6
3 changed files with 38 additions and 12 deletions

View File

@ -29,7 +29,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="set outfile=&quot;$(ProjectDir)\Src\svnrev.h&quot;&#x0D;&#x0A;&quot;$(ProjectDir)SubWCRev.exe&quot; &quot;$(SolutionDir)\.&quot; &quot;$(ProjectDir)\Src\svnrev_template.h&quot; %outfile%&#x0D;&#x0A;if errorlevel 1 (goto checkhg) else (goto VCEnd)&#x0D;&#x0A;:checkhg&#x0D;&#x0A;for /f &quot;usebackq tokens=1,* skip=3&quot; %%i in (`hg svn info`) do (&#x0D;&#x0A;echo Hg: Working copy at SVN revision %%j&#x0D;&#x0A;echo #define SVN_REV %%j &gt; %outfile%&#x0D;&#x0A;echo #define SVN_REV_STR &quot;%%j&quot; &gt;&gt; %outfile%&#x0D;&#x0A;goto VCEnd&#x0D;&#x0A;)&#x0D;&#x0A;" CommandLine="cscript /nologo &quot;$(ProjectDir)\make_svnrev.h.vbs&quot;"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
@ -98,7 +98,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="set outfile=&quot;$(ProjectDir)\Src\svnrev.h&quot;&#x0D;&#x0A;&quot;$(ProjectDir)SubWCRev.exe&quot; &quot;$(SolutionDir)\.&quot; &quot;$(ProjectDir)\Src\svnrev_template.h&quot; %outfile%&#x0D;&#x0A;if errorlevel 1 (goto checkhg) else (goto VCEnd)&#x0D;&#x0A;:checkhg&#x0D;&#x0A;for /f &quot;usebackq tokens=1,* skip=3&quot; %%i in (`hg svn info`) do (&#x0D;&#x0A;echo Hg: Working copy at SVN revision %%j&#x0D;&#x0A;echo #define SVN_REV %%j &gt; %outfile%&#x0D;&#x0A;echo #define SVN_REV_STR &quot;%%j&quot; &gt;&gt; %outfile%&#x0D;&#x0A;goto VCEnd&#x0D;&#x0A;)&#x0D;&#x0A;" CommandLine="cscript /nologo &quot;$(ProjectDir)\make_svnrev.h.vbs&quot;"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
@ -171,7 +171,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="set outfile=&quot;$(ProjectDir)\Src\svnrev.h&quot;&#x0D;&#x0A;&quot;$(ProjectDir)SubWCRev.exe&quot; &quot;$(SolutionDir)\.&quot; &quot;$(ProjectDir)\Src\svnrev_template.h&quot; %outfile%&#x0D;&#x0A;if errorlevel 1 (goto checkhg) else (goto VCEnd)&#x0D;&#x0A;:checkhg&#x0D;&#x0A;for /f &quot;usebackq tokens=1,* skip=3&quot; %%i in (`hg svn info`) do (&#x0D;&#x0A;echo Hg: Working copy at SVN revision %%j&#x0D;&#x0A;echo #define SVN_REV %%j &gt; %outfile%&#x0D;&#x0A;echo #define SVN_REV_STR &quot;%%j&quot; &gt;&gt; %outfile%&#x0D;&#x0A;goto VCEnd&#x0D;&#x0A;)&#x0D;&#x0A;" CommandLine="cscript /nologo &quot;$(ProjectDir)\make_svnrev.h.vbs&quot;"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
@ -244,7 +244,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="set outfile=&quot;$(ProjectDir)\Src\svnrev.h&quot;&#x0D;&#x0A;&quot;$(ProjectDir)SubWCRev.exe&quot; &quot;$(SolutionDir)\.&quot; &quot;$(ProjectDir)\Src\svnrev_template.h&quot; %outfile%&#x0D;&#x0A;if errorlevel 1 (goto checkhg) else (goto VCEnd)&#x0D;&#x0A;:checkhg&#x0D;&#x0A;for /f &quot;usebackq tokens=1,* skip=3&quot; %%i in (`hg svn info`) do (&#x0D;&#x0A;echo Hg: Working copy at SVN revision %%j&#x0D;&#x0A;echo #define SVN_REV %%j &gt; %outfile%&#x0D;&#x0A;echo #define SVN_REV_STR &quot;%%j&quot; &gt;&gt; %outfile%&#x0D;&#x0A;goto VCEnd&#x0D;&#x0A;)&#x0D;&#x0A;" CommandLine="cscript /nologo &quot;$(ProjectDir)\make_svnrev.h.vbs&quot;"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
@ -319,7 +319,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="set outfile=&quot;$(ProjectDir)\Src\svnrev.h&quot;&#x0D;&#x0A;&quot;$(ProjectDir)SubWCRev.exe&quot; &quot;$(SolutionDir)\.&quot; &quot;$(ProjectDir)\Src\svnrev_template.h&quot; %outfile%&#x0D;&#x0A;if errorlevel 1 (goto checkhg) else (goto VCEnd)&#x0D;&#x0A;:checkhg&#x0D;&#x0A;for /f &quot;usebackq tokens=1,* skip=3&quot; %%i in (`hg svn info`) do (&#x0D;&#x0A;echo Hg: Working copy at SVN revision %%j&#x0D;&#x0A;echo #define SVN_REV %%j &gt; %outfile%&#x0D;&#x0A;echo #define SVN_REV_STR &quot;%%j&quot; &gt;&gt; %outfile%&#x0D;&#x0A;goto VCEnd&#x0D;&#x0A;)&#x0D;&#x0A;" CommandLine="cscript /nologo &quot;$(ProjectDir)\make_svnrev.h.vbs&quot;"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
@ -389,7 +389,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="set outfile=&quot;$(ProjectDir)\Src\svnrev.h&quot;&#x0D;&#x0A;&quot;$(ProjectDir)SubWCRev.exe&quot; &quot;$(SolutionDir)\.&quot; &quot;$(ProjectDir)\Src\svnrev_template.h&quot; %outfile%&#x0D;&#x0A;if errorlevel 1 (goto checkhg) else (goto VCEnd)&#x0D;&#x0A;:checkhg&#x0D;&#x0A;for /f &quot;usebackq tokens=1,* skip=3&quot; %%i in (`hg svn info`) do (&#x0D;&#x0A;echo Hg: Working copy at SVN revision %%j&#x0D;&#x0A;echo #define SVN_REV %%j &gt; %outfile%&#x0D;&#x0A;echo #define SVN_REV_STR &quot;%%j&quot; &gt;&gt; %outfile%&#x0D;&#x0A;goto VCEnd&#x0D;&#x0A;)&#x0D;&#x0A;" CommandLine="cscript /nologo &quot;$(ProjectDir)\make_svnrev.h.vbs&quot;"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"

View File

@ -0,0 +1,26 @@
set wshShell = CreateObject("WScript.Shell")
outfile = "Src/svnrev.h"
svncmd = "SubWCRev ../../.. Src/svnrev_template.h " & outfile
hgcmd = "hg svn info"
ret = wshShell.run(svncmd, 0, true)
if ret <> 0 then ' Perhaps we should just check for 6? dunno/care...
set hgexec = wshShell.exec(hgcmd)
do while hgexec.status = 0 : wscript.sleep 100 : loop
do while true
line = hgexec.stdout.readline
if instr(line, "Revision") then
sline = split(line)
wscript.echo "Hg: Working copy at SVN revision " & sline(1)
set oFS = CreateObject("Scripting.fileSystemObject")
set oFile = oFS.CreateTextFile(outfile, true)
oFile.writeline("#define SVN_REV_STR """ & sline(1) & """")
set oFS = nothing
exit do
end if
if hgexec.stdout.atEndofStream then
wscript.echo "Neither SVN or Hg revision info found!"
wscript.quit 1
end if
loop
end if

View File

@ -30,7 +30,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="set outfile=&quot;$(ProjectDir)..\Common\Src\svnrev.h&quot;&#x0D;&#x0A;&quot;$(ProjectDir)..\Common\SubWCRev.exe&quot; &quot;$(SolutionDir)\.&quot; &quot;$(ProjectDir)..\Common\Src\svnrev_template.h&quot; %outfile%&#x0D;&#x0A;if errorlevel 1 (goto checkhg) else (goto VCEnd)&#x0D;&#x0A;:checkhg&#x0D;&#x0A;for /f &quot;usebackq tokens=1,* skip=3&quot; %%i in (`hg svn info`) do (&#x0D;&#x0A;echo Hg: Working copy at SVN revision %%j&#x0D;&#x0A;echo #define SVN_REV %%j &gt; %outfile%&#x0D;&#x0A;echo #define SVN_REV_STR &quot;%%j&quot; &gt;&gt; %outfile%&#x0D;&#x0A;goto VCEnd&#x0D;&#x0A;)&#x0D;&#x0A;" CommandLine="cscript /nologo &quot;..\Common\make_svnrev.h.vbs&quot;"
ExcludedFromBuild="false" ExcludedFromBuild="false"
/> />
<Tool <Tool
@ -146,7 +146,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="set outfile=&quot;$(ProjectDir)..\Common\Src\svnrev.h&quot;&#x0D;&#x0A;&quot;$(ProjectDir)..\Common\SubWCRev.exe&quot; &quot;$(SolutionDir)\.&quot; &quot;$(ProjectDir)..\Common\Src\svnrev_template.h&quot; %outfile%&#x0D;&#x0A;if errorlevel 1 (goto checkhg) else (goto VCEnd)&#x0D;&#x0A;:checkhg&#x0D;&#x0A;for /f &quot;usebackq tokens=1,* skip=3&quot; %%i in (`hg svn info`) do (&#x0D;&#x0A;echo Hg: Working copy at SVN revision %%j&#x0D;&#x0A;echo #define SVN_REV %%j &gt; %outfile%&#x0D;&#x0A;echo #define SVN_REV_STR &quot;%%j&quot; &gt;&gt; %outfile%&#x0D;&#x0A;goto VCEnd&#x0D;&#x0A;)&#x0D;&#x0A;" CommandLine="cscript /nologo &quot;..\Common\make_svnrev.h.vbs&quot;"
ExcludedFromBuild="false" ExcludedFromBuild="false"
/> />
<Tool <Tool
@ -263,7 +263,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="set outfile=&quot;$(ProjectDir)..\Common\Src\svnrev.h&quot;&#x0D;&#x0A;&quot;$(ProjectDir)..\Common\SubWCRev.exe&quot; &quot;$(SolutionDir)\.&quot; &quot;$(ProjectDir)..\Common\Src\svnrev_template.h&quot; %outfile%&#x0D;&#x0A;if errorlevel 1 (goto checkhg) else (goto VCEnd)&#x0D;&#x0A;:checkhg&#x0D;&#x0A;for /f &quot;usebackq tokens=1,* skip=3&quot; %%i in (`hg svn info`) do (&#x0D;&#x0A;echo Hg: Working copy at SVN revision %%j&#x0D;&#x0A;echo #define SVN_REV %%j &gt; %outfile%&#x0D;&#x0A;echo #define SVN_REV_STR &quot;%%j&quot; &gt;&gt; %outfile%&#x0D;&#x0A;goto VCEnd&#x0D;&#x0A;)&#x0D;&#x0A;" CommandLine="cscript /nologo &quot;..\Common\make_svnrev.h.vbs&quot;"
ExcludedFromBuild="false" ExcludedFromBuild="false"
/> />
<Tool <Tool
@ -374,7 +374,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="set outfile=&quot;$(ProjectDir)..\Common\Src\svnrev.h&quot;&#x0D;&#x0A;&quot;$(ProjectDir)..\Common\SubWCRev.exe&quot; &quot;$(SolutionDir)\.&quot; &quot;$(ProjectDir)..\Common\Src\svnrev_template.h&quot; %outfile%&#x0D;&#x0A;if errorlevel 1 (goto checkhg) else (goto VCEnd)&#x0D;&#x0A;:checkhg&#x0D;&#x0A;for /f &quot;usebackq tokens=1,* skip=3&quot; %%i in (`hg svn info`) do (&#x0D;&#x0A;echo Hg: Working copy at SVN revision %%j&#x0D;&#x0A;echo #define SVN_REV %%j &gt; %outfile%&#x0D;&#x0A;echo #define SVN_REV_STR &quot;%%j&quot; &gt;&gt; %outfile%&#x0D;&#x0A;goto VCEnd&#x0D;&#x0A;)&#x0D;&#x0A;" CommandLine="cscript /nologo &quot;..\Common\make_svnrev.h.vbs&quot;"
ExcludedFromBuild="false" ExcludedFromBuild="false"
/> />
<Tool <Tool
@ -485,7 +485,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="set outfile=&quot;$(ProjectDir)..\Common\Src\svnrev.h&quot;&#x0D;&#x0A;&quot;$(ProjectDir)..\Common\SubWCRev.exe&quot; &quot;$(SolutionDir)\.&quot; &quot;$(ProjectDir)..\Common\Src\svnrev_template.h&quot; %outfile%&#x0D;&#x0A;if errorlevel 1 (goto checkhg) else (goto VCEnd)&#x0D;&#x0A;:checkhg&#x0D;&#x0A;for /f &quot;usebackq tokens=1,* skip=3&quot; %%i in (`hg svn info`) do (&#x0D;&#x0A;echo Hg: Working copy at SVN revision %%j&#x0D;&#x0A;echo #define SVN_REV %%j &gt; %outfile%&#x0D;&#x0A;echo #define SVN_REV_STR &quot;%%j&quot; &gt;&gt; %outfile%&#x0D;&#x0A;goto VCEnd&#x0D;&#x0A;)&#x0D;&#x0A;" CommandLine="cscript /nologo &quot;..\Common\make_svnrev.h.vbs&quot;"
ExcludedFromBuild="false" ExcludedFromBuild="false"
/> />
<Tool <Tool
@ -600,7 +600,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="set outfile=&quot;$(ProjectDir)..\Common\Src\svnrev.h&quot;&#x0D;&#x0A;&quot;$(ProjectDir)..\Common\SubWCRev.exe&quot; &quot;$(SolutionDir)\.&quot; &quot;$(ProjectDir)..\Common\Src\svnrev_template.h&quot; %outfile%&#x0D;&#x0A;if errorlevel 1 (goto checkhg) else (goto VCEnd)&#x0D;&#x0A;:checkhg&#x0D;&#x0A;for /f &quot;usebackq tokens=1,* skip=3&quot; %%i in (`hg svn info`) do (&#x0D;&#x0A;echo Hg: Working copy at SVN revision %%j&#x0D;&#x0A;echo #define SVN_REV %%j &gt; %outfile%&#x0D;&#x0A;echo #define SVN_REV_STR &quot;%%j&quot; &gt;&gt; %outfile%&#x0D;&#x0A;goto VCEnd&#x0D;&#x0A;)&#x0D;&#x0A;" CommandLine="cscript /nologo &quot;..\Common\make_svnrev.h.vbs&quot;"
ExcludedFromBuild="false" ExcludedFromBuild="false"
/> />
<Tool <Tool