diff options
author | ShizZy <shizzy@6bit.net> | 2014-04-24 04:04:33 +0200 |
---|---|---|
committer | ShizZy <shizzy@6bit.net> | 2014-04-24 04:04:33 +0200 |
commit | 121960a2eb2141ac9313803b88f9adb043407475 (patch) | |
tree | d6cea03497f720eb2ebd17970292becf742125c2 /src | |
parent | added scm rev generation on Linux/cmake (diff) | |
download | yuzu-121960a2eb2141ac9313803b88f9adb043407475.tar yuzu-121960a2eb2141ac9313803b88f9adb043407475.tar.gz yuzu-121960a2eb2141ac9313803b88f9adb043407475.tar.bz2 yuzu-121960a2eb2141ac9313803b88f9adb043407475.tar.lz yuzu-121960a2eb2141ac9313803b88f9adb043407475.tar.xz yuzu-121960a2eb2141ac9313803b88f9adb043407475.tar.zst yuzu-121960a2eb2141ac9313803b88f9adb043407475.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/common/common.vcxproj | 3 | ||||
-rw-r--r-- | src/common/common.vcxproj.filters | 3 | ||||
-rw-r--r-- | src/common/scm_rev.h | 3 | ||||
-rw-r--r-- | src/common/scm_rev_gen.js | 109 | ||||
-rw-r--r-- | src/common/scm_rev_gen.vcxproj | 1 |
5 files changed, 53 insertions, 66 deletions
diff --git a/src/common/common.vcxproj b/src/common/common.vcxproj index 202d00d18..5048bebff 100644 --- a/src/common/common.vcxproj +++ b/src/common/common.vcxproj @@ -181,6 +181,7 @@ <ClInclude Include="mem_arena.h" /> <ClInclude Include="msg_handler.h" /> <ClInclude Include="platform.h" /> + <ClInclude Include="scm_rev.h" /> <ClInclude Include="std_condition_variable.h" /> <ClInclude Include="std_mutex.h" /> <ClInclude Include="std_thread.h" /> @@ -205,12 +206,12 @@ <ClCompile Include="mem_arena.cpp" /> <ClCompile Include="misc.cpp" /> <ClCompile Include="msg_handler.cpp" /> + <ClCompile Include="scm_rev.cpp" /> <ClCompile Include="string_util.cpp" /> <ClCompile Include="symbols.cpp" /> <ClCompile Include="thread.cpp" /> <ClCompile Include="timer.cpp" /> <ClCompile Include="utf8.cpp" /> - <ClCompile Include="version.cpp" /> </ItemGroup> <ItemGroup> <Text Include="CMakeLists.txt" /> diff --git a/src/common/common.vcxproj.filters b/src/common/common.vcxproj.filters index bd4d27b58..e9ea40022 100644 --- a/src/common/common.vcxproj.filters +++ b/src/common/common.vcxproj.filters @@ -38,6 +38,7 @@ <ClInclude Include="timer.h" /> <ClInclude Include="utf8.h" /> <ClInclude Include="symbols.h" /> + <ClInclude Include="scm_rev.h" /> </ItemGroup> <ItemGroup> <ClCompile Include="break_points.cpp" /> @@ -56,8 +57,8 @@ <ClCompile Include="thread.cpp" /> <ClCompile Include="timer.cpp" /> <ClCompile Include="utf8.cpp" /> - <ClCompile Include="version.cpp" /> <ClCompile Include="symbols.cpp" /> + <ClCompile Include="scm_rev.cpp" /> </ItemGroup> <ItemGroup> <Text Include="CMakeLists.txt" /> diff --git a/src/common/scm_rev.h b/src/common/scm_rev.h index 7f5ce119c..d34664614 100644 --- a/src/common/scm_rev.h +++ b/src/common/scm_rev.h @@ -7,8 +7,7 @@ namespace Common { extern const char g_scm_rev[]; -extern const char g_scm_ref_spec[]; +extern const char g_scm_branch[]; extern const char g_scm_desc[]; } // namespace - diff --git a/src/common/scm_rev_gen.js b/src/common/scm_rev_gen.js index a57d03dda..29c913b85 100644 --- a/src/common/scm_rev_gen.js +++ b/src/common/scm_rev_gen.js @@ -1,80 +1,67 @@ -var wshShell = new ActiveXObject("WScript.Shell") -var oFS = new ActiveXObject("Scripting.FileSystemObject"); +var wshShell = new ActiveXObject("WScript.Shell") +var oFS = new ActiveXObject("Scripting.FileSystemObject"); -var outfile = "scm_rev.h"; -var cmd_revision = " rev-parse HEAD"; -var cmd_describe = " describe --always --long --dirty"; -var cmd_branch = " rev-parse --abbrev-ref HEAD"; +var outfile = "scm_rev.cpp"; +var cmd_revision = " rev-parse HEAD"; +var cmd_describe = " describe --always --long --dirty"; +var cmd_branch = " rev-parse --abbrev-ref HEAD"; -function GetGitExe() -{ - for (var gitexe in {"git.cmd":1, "git":1}) - { - try - { - wshShell.Exec(gitexe); - return gitexe; - } - catch (e) - {} - } +function GetGitExe() { + for (var gitexe in { "git.cmd": 1, "git": 1 }) { + try { + wshShell.Exec(gitexe); + return gitexe; + } catch (e) { + } + } - WScript.Echo("Cannot find git or git.cmd, check your PATH:\n" + - wshShell.ExpandEnvironmentStrings("%PATH%")); - WScript.Quit(1); + WScript.Echo("Cannot find git or git.cmd, check your PATH:\n" + + wshShell.ExpandEnvironmentStrings("%PATH%")); + WScript.Quit(1); } -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 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 GetFileContents(f) -{ - try - { - return oFS.OpenTextFile(f).ReadAll(); - } - catch (e) - { - // file doesn't exist - return ""; - } +function GetFileContents(f) { + try { + return oFS.OpenTextFile(f).ReadAll(); + } catch (e) { + // file doesn't exist + return ""; + } } // 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 gitexe = GetGitExe(); +var revision = GetFirstStdOutLine(gitexe + cmd_revision); +var describe = GetFirstStdOutLine(gitexe + cmd_describe); +var branch = GetFirstStdOutLine(gitexe + cmd_branch); var isMaster = +("master" == branch); // remove hash (and trailing "-0" if needed) from description describe = describe.replace(/(-0)?-[^-]+(-dirty)?$/, '$2'); 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"; + "#include \"common/scm_rev.h\"\n" + + "namespace Common {\n" + + " const char g_scm_rev[] = \"" + revision + "\";\n" + + " const char g_scm_branch[] = \"" + branch + "\";\n" + + " const char g_scm_desc[] = \"" + describe + "\";\n" + + "}\n"; // check if file needs updating -if (out_contents == GetFileContents(outfile)) -{ - WScript.Echo(outfile + " current at " + describe); -} -else -{ - // needs updating - writeout current info - oFS.CreateTextFile(outfile, true).Write(out_contents); - WScript.Echo(outfile + " updated to " + describe); +if (out_contents == GetFileContents(outfile)) { + WScript.Echo(outfile + " current at " + describe); +} else { + // needs updating - writeout current info + oFS.CreateTextFile(outfile, true).Write(out_contents); + WScript.Echo(outfile + " updated to " + describe); } diff --git a/src/common/scm_rev_gen.vcxproj b/src/common/scm_rev_gen.vcxproj index 6b81c9055..f4f2a6239 100644 --- a/src/common/scm_rev_gen.vcxproj +++ b/src/common/scm_rev_gen.vcxproj @@ -20,7 +20,6 @@ </ItemGroup> <ItemGroup> <ClInclude Include="force_rebuild.h" /> - <ClInclude Include="scm_rev.h" /> </ItemGroup> <ItemGroup> <None Include="scm_rev_gen.js" /> |