summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2011-08-21 19:15:50 -0700
committerShawn Hoffman <godisgovernment@gmail.com>2011-08-21 19:15:50 -0700
commitfc1263305591f2714b93c8e1794dfdc0f4ecb1cb (patch)
treefe9406e3e07381b654242d6861bc0576d51cfac8 /Source/Core
parent9613713e14935af7e016bddf828096542a5bdca4 (diff)
Make the jscript for writing out scmrev.h work on windows.
Add scmrev.h to .gitignore Remove some SubWCRev.exe and it's template
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/SVNRevGen.vcxproj11
-rw-r--r--Source/Core/Common/Src/svnrev_template.h1
-rw-r--r--Source/Core/Common/SubWCRev.exebin552960 -> 0 bytes
-rw-r--r--Source/Core/Common/make_scmrev.h.js88
-rw-r--r--Source/Core/Common/make_svnrev.h.js87
-rw-r--r--Source/Core/DolphinWX/Src/AboutDolphin.cpp2
6 files changed, 91 insertions, 98 deletions
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 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
- <CustomBuild Include="make_svnrev.h.js">
- <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">cscript /nologo /E:JScript "make_svnrev.h.js"</Command>
- <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Updating svnrev.h</Message>
- <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">dummy</Outputs>
- </CustomBuild>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="Src\svnrev.h" />
- <ClInclude Include="Src\svnrev_template.h" />
+ <None Include="make_scmrev.h.js" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{69F00340-5C3D-449F-9A80-958435C6CF06}</ProjectGuid>
<RootNamespace>SVNRevGen</RootNamespace>
+ <ProjectName>SCMRevGen</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
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
--- a/Source/Core/Common/SubWCRev.exe
+++ /dev/null
Binary files 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"