mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-02 22:14:12 +00:00
Change make_svnrev.h.vbs so that it won't cause svnrev.h to be regenerated if it's already at the current revision (saves re-linking all the time)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6065 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
b2791b2d79
commit
521c7558bc
@ -2,21 +2,38 @@ set wshShell = CreateObject("WScript.Shell")
|
|||||||
basedir = wscript.arguments(0)
|
basedir = wscript.arguments(0)
|
||||||
outfile = basedir & "/Src/svnrev.h"
|
outfile = basedir & "/Src/svnrev.h"
|
||||||
svncmd = "SubWCRev ../../.. " & basedir & "/Src/svnrev_template.h " & outfile
|
svncmd = "SubWCRev ../../.. " & basedir & "/Src/svnrev_template.h " & outfile
|
||||||
|
svntestcmd = "SubWCRev ../../.."
|
||||||
hgcmd = "hg svn info"
|
hgcmd = "hg svn info"
|
||||||
|
const svn = 0
|
||||||
|
const hg = 1
|
||||||
|
|
||||||
ret = wshShell.run(svncmd, 0, true)
|
set oFS = CreateObject("Scripting.fileSystemObject")
|
||||||
if ret <> 0 then ' Perhaps we should just check for 6? dunno/care...
|
if not oFS.FileExists(outfile) then
|
||||||
set hgexec = wshShell.exec(hgcmd)
|
oFS.CreateTextFile(outfile)
|
||||||
|
file_rev = 0
|
||||||
|
else
|
||||||
|
set oFile = oFS.OpenTextFile(outfile)
|
||||||
|
set re = new regexp
|
||||||
|
re.pattern = "[0-9]+"
|
||||||
|
file_rev = re.execute(oFile.readline)(0)
|
||||||
|
end if
|
||||||
|
|
||||||
|
set testexec = wshShell.exec(svntestcmd)
|
||||||
|
do while testexec.status = 0 : wscript.sleep 100 : loop
|
||||||
|
if testexec.exitcode = 0 then
|
||||||
|
testout = testexec.stdout.readall
|
||||||
|
set re = new regexp
|
||||||
|
re.pattern = "Updated to revision [0-9]+"
|
||||||
|
cur_rev = split(re.execute(testout)(0))(3)
|
||||||
|
cur_cms = svn
|
||||||
|
else
|
||||||
|
set hgexec = wshShell.exec(hgcmd)
|
||||||
do while hgexec.status = 0 : wscript.sleep 100 : loop
|
do while hgexec.status = 0 : wscript.sleep 100 : loop
|
||||||
do while true
|
do while true
|
||||||
line = hgexec.stdout.readline
|
line = hgexec.stdout.readline
|
||||||
if instr(line, "Revision") then
|
if instr(line, "Revision") then
|
||||||
sline = split(line)
|
cur_rev = split(line)(1)
|
||||||
wscript.echo "Hg: Working copy at SVN revision " & sline(1)
|
cur_cms = hg
|
||||||
set oFS = CreateObject("Scripting.fileSystemObject")
|
|
||||||
set oFile = oFS.CreateTextFile(outfile, true)
|
|
||||||
oFile.writeline("#define SVN_REV_STR """ & sline(1) & """")
|
|
||||||
set oFS = nothing
|
|
||||||
exit do
|
exit do
|
||||||
end if
|
end if
|
||||||
if hgexec.stdout.atEndofStream then
|
if hgexec.stdout.atEndofStream then
|
||||||
@ -25,3 +42,15 @@ if ret <> 0 then ' Perhaps we should just check for 6? dunno/care...
|
|||||||
end if
|
end if
|
||||||
loop
|
loop
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
if file_rev = cur_rev then
|
||||||
|
wscript.echo "svnrev.h doesn't need updating"
|
||||||
|
wscript.quit 0
|
||||||
|
elseif cur_cms = svn then
|
||||||
|
ret = wshShell.run(svncmd, 0, true)
|
||||||
|
elseif cur_cms = hg then
|
||||||
|
set oFile = CreateObject("Scripting.fileSystemObject").CreateTextFile(outfile, true)
|
||||||
|
oFile.writeline("#define SVN_REV_STR """ & cur_rev & """")
|
||||||
|
else
|
||||||
|
wscript.echo "WTF, shouldn't be here!"
|
||||||
|
end if
|
Loading…
x
Reference in New Issue
Block a user