diff --git a/.gitignore b/.gitignore index 22e80a5475..d40ea5abe2 100644 --- a/.gitignore +++ b/.gitignore @@ -29,9 +29,8 @@ _ReSharper*/ [Tt]est[Rr]esult* Binary/Win32 Binary/x64 -Source/Core/Common/Src/svnrev.h +Source/Core/Common/Src/scmrev.h *.opensdf *.sdf [Bb]uild - *.ipch \ No newline at end of file diff --git a/Source/Core/Common/SVNRevGen.vcxproj b/Source/Core/Common/SVNRevGen.vcxproj index 45d6d10368..357d2b4bbe 100644 --- a/Source/Core/Common/SVNRevGen.vcxproj +++ b/Source/Core/Common/SVNRevGen.vcxproj @@ -7,19 +7,12 @@ - - cscript /nologo /E:JScript "make_svnrev.h.js" - Updating svnrev.h - dummy - - - - - + {69F00340-5C3D-449F-9A80-958435C6CF06} SVNRevGen + SCMRevGen diff --git a/Source/Core/Common/Src/svnrev_template.h b/Source/Core/Common/Src/svnrev_template.h deleted file mode 100644 index 0d3e482e1b..0000000000 --- a/Source/Core/Common/Src/svnrev_template.h +++ /dev/null @@ -1 +0,0 @@ -#define SVN_REV_STR "$WCMODS?$WCREV$M:$WCREV$$" diff --git a/Source/Core/Common/SubWCRev.exe b/Source/Core/Common/SubWCRev.exe deleted file mode 100644 index 32a252b58b..0000000000 Binary files a/Source/Core/Common/SubWCRev.exe and /dev/null differ diff --git a/Source/Core/Common/make_scmrev.h.js b/Source/Core/Common/make_scmrev.h.js new file mode 100644 index 0000000000..7d7290c75b --- /dev/null +++ b/Source/Core/Common/make_scmrev.h.js @@ -0,0 +1,88 @@ +var wshShell = new ActiveXObject("WScript.Shell") +var oFS = new ActiveXObject("Scripting.FileSystemObject"); + +var outfile = "./Src/scmrev.h"; +var cmd_revision = " rev-parse HEAD"; +var cmd_describe = " describe --always --dirty"; +var cmd_branch = " rev-parse --abbrev-ref HEAD"; + +function GetGitExe() +{ + var gitexe = "git.cmd"; + try + { + wshShell.Exec(gitexe); + } + catch (e) + { + try + { + gitexe = "git"; + wshShell.Exec(gitexe); + } + catch (e) + { + WScript.Echo("Cannot find git or git.cmd, check your PATH:\n" + + wshShell.ExpandEnvironmentStrings("%PATH%")); + WScript.Quit(1); + } + } + return gitexe; +} + +function GetFirstStdOutLine(cmd) +{ + try + { + return wshShell.Exec(cmd).StdOut.ReadLine(); + } + catch (e) + { + // catch "the system cannot find the file specified" error + WScript.Echo("Failed to exec " + cmd + " this should never happen"); + WScript.Quit(1); + } +} + +function GetRevFromFile(f) +{ + try + { + // read the current hash + return oFS.OpenTextFile(f).ReadAll().match(/SCM_REV_STR\s+"([0-9a-f]+)/)[1]; + } + catch (e) + { + // file doesn't exist or string not found, (re)create it + oFS.CreateTextFile(f); + return 0; + } +} + +// get info from git +var gitexe = GetGitExe(); +var revision = GetFirstStdOutLine(gitexe + cmd_revision); +var describe = GetFirstStdOutLine(gitexe + cmd_describe); +var branch = GetFirstStdOutLine(gitexe + cmd_branch); +var isMaster = 0 + +if (branch == "master") + isMaster = 1 + +var out_contents = + "#define SCM_REV_STR \"" + revision + "\"\n" + + "#define SCM_DESC_STR \"" + describe + "\"\n" + + "#define SCM_BRANCH_STR \"" + branch + "\"\n" + + "#define SCM_IS_MASTER " + isMaster + "\n"; + +// check if file needs updating +if (revision == GetRevFromFile(outfile)) +{ + WScript.Echo(outfile + " doesn't need updating (already at " + revision + ")"); +} +else +{ + // needs updating - writeout current info + oFS.CreateTextFile(outfile, true).Write(out_contents); + WScript.Echo(outfile + " updated (" + revision + ")"); +} diff --git a/Source/Core/Common/make_svnrev.h.js b/Source/Core/Common/make_svnrev.h.js deleted file mode 100644 index a68485e0f6..0000000000 --- a/Source/Core/Common/make_svnrev.h.js +++ /dev/null @@ -1,87 +0,0 @@ -var wshShell = new ActiveXObject("WScript.Shell") -var oFS = new ActiveXObject("Scripting.FileSystemObject"); - -var outfile = "./Src/svnrev.h"; -var svncmd = "SubWCRev ../../.. ./Src/svnrev_template.h " + outfile; -var svntestcmd = "SubWCRev ../../.."; -var hgcmd = "hg svn info"; -var gitcmd = "git.cmd rev-parse HEAD"; - -var SVN = 1, HG = 2, git = 3; -var file_rev = 0, cur_rev = 0, cur_cms = 0; - -function RunCmdGetMatch(cmd, regex) -{ - // run the command - try - { - var cmdexec = wshShell.Exec(cmd); - } - catch (e) - { - // catch "the system cannot find the file specified" error - return 0; - } - // ReadLine is synchronous - while (!cmdexec.StdOut.AtEndOfStream) - { - var reg_exec = regex.exec(cmdexec.StdOut.ReadLine()) - if (reg_exec) - return reg_exec[1]; // return first capture group - } - // failed - return 0; -} - -try -{ - // read the value of SVN_REV_STR - file_rev = oFS.OpenTextFile(outfile).ReadLine().match(/\d+/); -} -catch (e) -{ - // file doesn't exist or string not found, (re)create it - oFS.CreateTextFile(outfile); -} - -// get the "Last commited at revision" from SubWCRev's output -cur_rev = RunCmdGetMatch(svntestcmd, /^Last .*?(\d+)/); -if (cur_rev) - cur_cms = SVN; -else -{ - // SubWCRev failed, try hg - cur_rev = RunCmdGetMatch(hgcmd, /Revision.*?(\d+)/); - if (cur_rev) - cur_cms = HG; - else - { - // hg failed, try git - cur_rev = RunCmdGetMatch(gitcmd, /(.*)/); - if (cur_rev) - cur_cms = git; - else - { - WScript.Echo("Trying to get SVN, Hg, and git info all failed"); - WScript.Quit(1); - } - } -} - -// check if svnrev.h needs updating -if (cur_rev == file_rev) -{ - WScript.Echo("svnrev.h doesn't need updating (already at " + cur_rev + ")"); - WScript.Quit(0); -} -else if (cur_cms == SVN) -{ - // update using SubWCRev and template file - var ret = wshShell.run(svncmd, 0, true); -} -else -{ - // manually create the file - oFS.CreateTextFile(outfile, true).WriteLine("#define SVN_REV_STR \"" + cur_rev + "\""); -} -WScript.Echo("svnrev.h updated (" + cur_rev + ")"); \ No newline at end of file diff --git a/Source/Core/DolphinWX/Src/AboutDolphin.cpp b/Source/Core/DolphinWX/Src/AboutDolphin.cpp index 11e8dbd98c..d13c12ee7f 100644 --- a/Source/Core/DolphinWX/Src/AboutDolphin.cpp +++ b/Source/Core/DolphinWX/Src/AboutDolphin.cpp @@ -35,7 +35,7 @@ AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id, "\n" "Branch: " SCM_BRANCH_STR "\n" "Revision: " SCM_REV_STR "\n" - "Date: " __DATE__ " @ " __TIME__ "\n" + "Compiled: " __DATE__ " @ " __TIME__ "\n" "\n" "Dolphin is a Gamecube/Wii emulator, which was\n" "originally written by F|RES and ector.\n"