updated windows scm_rev code to use new style
This commit is contained in:
parent
4405a53cf3
commit
121960a2eb
6 changed files with 55 additions and 66 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -23,3 +23,5 @@ ipch/
|
||||||
build/
|
build/
|
||||||
bin/
|
bin/
|
||||||
|
|
||||||
|
# Generated source files
|
||||||
|
src/common/scm_rev.cpp
|
||||||
|
|
|
@ -181,6 +181,7 @@
|
||||||
<ClInclude Include="mem_arena.h" />
|
<ClInclude Include="mem_arena.h" />
|
||||||
<ClInclude Include="msg_handler.h" />
|
<ClInclude Include="msg_handler.h" />
|
||||||
<ClInclude Include="platform.h" />
|
<ClInclude Include="platform.h" />
|
||||||
|
<ClInclude Include="scm_rev.h" />
|
||||||
<ClInclude Include="std_condition_variable.h" />
|
<ClInclude Include="std_condition_variable.h" />
|
||||||
<ClInclude Include="std_mutex.h" />
|
<ClInclude Include="std_mutex.h" />
|
||||||
<ClInclude Include="std_thread.h" />
|
<ClInclude Include="std_thread.h" />
|
||||||
|
@ -205,12 +206,12 @@
|
||||||
<ClCompile Include="mem_arena.cpp" />
|
<ClCompile Include="mem_arena.cpp" />
|
||||||
<ClCompile Include="misc.cpp" />
|
<ClCompile Include="misc.cpp" />
|
||||||
<ClCompile Include="msg_handler.cpp" />
|
<ClCompile Include="msg_handler.cpp" />
|
||||||
|
<ClCompile Include="scm_rev.cpp" />
|
||||||
<ClCompile Include="string_util.cpp" />
|
<ClCompile Include="string_util.cpp" />
|
||||||
<ClCompile Include="symbols.cpp" />
|
<ClCompile Include="symbols.cpp" />
|
||||||
<ClCompile Include="thread.cpp" />
|
<ClCompile Include="thread.cpp" />
|
||||||
<ClCompile Include="timer.cpp" />
|
<ClCompile Include="timer.cpp" />
|
||||||
<ClCompile Include="utf8.cpp" />
|
<ClCompile Include="utf8.cpp" />
|
||||||
<ClCompile Include="version.cpp" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Text Include="CMakeLists.txt" />
|
<Text Include="CMakeLists.txt" />
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
<ClInclude Include="timer.h" />
|
<ClInclude Include="timer.h" />
|
||||||
<ClInclude Include="utf8.h" />
|
<ClInclude Include="utf8.h" />
|
||||||
<ClInclude Include="symbols.h" />
|
<ClInclude Include="symbols.h" />
|
||||||
|
<ClInclude Include="scm_rev.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="break_points.cpp" />
|
<ClCompile Include="break_points.cpp" />
|
||||||
|
@ -56,8 +57,8 @@
|
||||||
<ClCompile Include="thread.cpp" />
|
<ClCompile Include="thread.cpp" />
|
||||||
<ClCompile Include="timer.cpp" />
|
<ClCompile Include="timer.cpp" />
|
||||||
<ClCompile Include="utf8.cpp" />
|
<ClCompile Include="utf8.cpp" />
|
||||||
<ClCompile Include="version.cpp" />
|
|
||||||
<ClCompile Include="symbols.cpp" />
|
<ClCompile Include="symbols.cpp" />
|
||||||
|
<ClCompile Include="scm_rev.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Text Include="CMakeLists.txt" />
|
<Text Include="CMakeLists.txt" />
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
extern const char g_scm_rev[];
|
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[];
|
extern const char g_scm_desc[];
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,18 @@
|
||||||
var wshShell = new ActiveXObject("WScript.Shell")
|
var wshShell = new ActiveXObject("WScript.Shell")
|
||||||
var oFS = new ActiveXObject("Scripting.FileSystemObject");
|
var oFS = new ActiveXObject("Scripting.FileSystemObject");
|
||||||
|
|
||||||
var outfile = "scm_rev.h";
|
var outfile = "scm_rev.cpp";
|
||||||
var cmd_revision = " rev-parse HEAD";
|
var cmd_revision = " rev-parse HEAD";
|
||||||
var cmd_describe = " describe --always --long --dirty";
|
var cmd_describe = " describe --always --long --dirty";
|
||||||
var cmd_branch = " rev-parse --abbrev-ref HEAD";
|
var cmd_branch = " rev-parse --abbrev-ref HEAD";
|
||||||
|
|
||||||
function GetGitExe()
|
function GetGitExe() {
|
||||||
{
|
for (var gitexe in { "git.cmd": 1, "git": 1 }) {
|
||||||
for (var gitexe in {"git.cmd":1, "git":1})
|
try {
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
wshShell.Exec(gitexe);
|
wshShell.Exec(gitexe);
|
||||||
return gitexe;
|
return gitexe;
|
||||||
|
} catch (e) {
|
||||||
}
|
}
|
||||||
catch (e)
|
|
||||||
{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WScript.Echo("Cannot find git or git.cmd, check your PATH:\n" +
|
WScript.Echo("Cannot find git or git.cmd, check your PATH:\n" +
|
||||||
|
@ -24,28 +20,20 @@ function GetGitExe()
|
||||||
WScript.Quit(1);
|
WScript.Quit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetFirstStdOutLine(cmd)
|
function GetFirstStdOutLine(cmd) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return wshShell.Exec(cmd).StdOut.ReadLine();
|
return wshShell.Exec(cmd).StdOut.ReadLine();
|
||||||
}
|
} catch (e) {
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
// catch "the system cannot find the file specified" error
|
// catch "the system cannot find the file specified" error
|
||||||
WScript.Echo("Failed to exec " + cmd + " this should never happen");
|
WScript.Echo("Failed to exec " + cmd + " this should never happen");
|
||||||
WScript.Quit(1);
|
WScript.Quit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetFileContents(f)
|
function GetFileContents(f) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return oFS.OpenTextFile(f).ReadAll();
|
return oFS.OpenTextFile(f).ReadAll();
|
||||||
}
|
} catch (e) {
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
// file doesn't exist
|
// file doesn't exist
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -62,18 +50,17 @@ var isMaster = +("master" == branch);
|
||||||
describe = describe.replace(/(-0)?-[^-]+(-dirty)?$/, '$2');
|
describe = describe.replace(/(-0)?-[^-]+(-dirty)?$/, '$2');
|
||||||
|
|
||||||
var out_contents =
|
var out_contents =
|
||||||
"#define SCM_REV_STR \"" + revision + "\"\n" +
|
"#include \"common/scm_rev.h\"\n" +
|
||||||
"#define SCM_DESC_STR \"" + describe + "\"\n" +
|
"namespace Common {\n" +
|
||||||
"#define SCM_BRANCH_STR \"" + branch + "\"\n" +
|
" const char g_scm_rev[] = \"" + revision + "\";\n" +
|
||||||
"#define SCM_IS_MASTER " + isMaster + "\n";
|
" const char g_scm_branch[] = \"" + branch + "\";\n" +
|
||||||
|
" const char g_scm_desc[] = \"" + describe + "\";\n" +
|
||||||
|
"}\n";
|
||||||
|
|
||||||
// check if file needs updating
|
// check if file needs updating
|
||||||
if (out_contents == GetFileContents(outfile))
|
if (out_contents == GetFileContents(outfile)) {
|
||||||
{
|
|
||||||
WScript.Echo(outfile + " current at " + describe);
|
WScript.Echo(outfile + " current at " + describe);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// needs updating - writeout current info
|
// needs updating - writeout current info
|
||||||
oFS.CreateTextFile(outfile, true).Write(out_contents);
|
oFS.CreateTextFile(outfile, true).Write(out_contents);
|
||||||
WScript.Echo(outfile + " updated to " + describe);
|
WScript.Echo(outfile + " updated to " + describe);
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="force_rebuild.h" />
|
<ClInclude Include="force_rebuild.h" />
|
||||||
<ClInclude Include="scm_rev.h" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="scm_rev_gen.js" />
|
<None Include="scm_rev_gen.js" />
|
||||||
|
|
Loading…
Reference in a new issue