Merge branch 'unclean-versioning' into 'master'

Unclean version marker

This implements a way to identify "unclean versions" where changes have been done to the code that weren't committed properly. Version with such changes will be marked with a "*" suffix in game and at various other places where the revision format is shown in the rXXX-MILESTONE syntax.
This commit is contained in:
/dev/urandom 2016-03-17 02:42:36 +01:00
commit db837b6168
No known key found for this signature in database
GPG Key ID: 41322B973E0F295E
4 changed files with 36 additions and 7 deletions

View File

@ -18,7 +18,6 @@ exit /B 1
:build
set PLATFORM=Win32
set CONFIGURATION=ReleaseStatic
call generate
msbuild /nologo /m /v:m %* build\iw4x.sln
endlocal
exit /B %ERRORLEVEL%

View File

@ -33,8 +33,20 @@ newaction {
local revNumber = assert(proc:read('*a')):gsub("%s+", "")
proc:close()
-- get whether this is a clean revision (no uncommitted changes)
local proc = assert(io.popen("git status --porcelain", "r"))
local revClean = 1
local revCleanSuffix = ""
if assert(proc:read('*a')) ~= "" then
revClean = 0
revCleanSuffix = " (unclean)"
end
proc:close()
-- get old version number from version.hpp if any
local oldRevNumber = "(none)"
local oldRevClean = 1
local oldRevCleanSuffix = ""
local oldVersionHeader = io.open(wks.location .. "/src/version.hpp", "r")
if oldVersionHeader ~=nil then
local oldVersionHeaderContent = assert(oldVersionHeader:read('*a'))
@ -43,11 +55,23 @@ newaction {
-- old version.hpp format?
oldRevNumber = "(none)"
end
oldRevClean = string.match(oldVersionHeaderContent, "#define REVISION_CLEAN (%d+)")
if oldRevClean == nil then
-- old version.hpp format?
oldRevClean = 1
elseif oldRevClean ~= "1" then
oldRevClean = 0
else
oldRevClean = 1
end
end
if oldRevClean == 0 then
oldRevCleanSuffix = " (unclean)"
end
-- generate version.hpp with a revision number if not equal
if oldRevNumber ~= revNumber then
print ("Update " .. oldRevNumber .. " -> " .. revNumber)
if oldRevNumber ~= revNumber or oldRevClean ~= revClean then
print ("Update " .. oldRevNumber .. oldRevCleanSuffix .. " -> " .. revNumber .. revCleanSuffix)
local versionHeader = assert(io.open(wks.location .. "/src/version.hpp", "w"))
versionHeader:write("/*\n")
versionHeader:write(" * Automatically generated by premake5.\n")
@ -55,6 +79,7 @@ newaction {
versionHeader:write(" */\n")
versionHeader:write("\n")
versionHeader:write("#define REVISION " .. revNumber .. "\n")
versionHeader:write("#define REVISION_CLEAN " .. revClean .. "\n")
versionHeader:close()
end
end

View File

@ -118,16 +118,16 @@ namespace Components
Utils::Hook::Set<char*>(0x6431D1, BASEGAME);
// UI version string
Utils::Hook::Set<char*>(0x43F73B, "IW4x: r" REVISION_STR "-" MILESTONE);
Utils::Hook::Set<char*>(0x43F73B, "IW4x: r" REVISION_STR REVISION_SUFFIX "-" MILESTONE);
// console version string
Utils::Hook::Set<char*>(0x4B12BB, "IW4x r" REVISION_STR "-" MILESTONE " (built " __DATE__ " " __TIME__ ")");
Utils::Hook::Set<char*>(0x4B12BB, "IW4x r" REVISION_STR REVISION_SUFFIX "-" MILESTONE " (built " __DATE__ " " __TIME__ ")");
// version string
Utils::Hook::Set<char*>(0x60BD56, "IW4x (r" REVISION_STR ")");
Utils::Hook::Set<char*>(0x60BD56, "IW4x (r" REVISION_STR REVISION_SUFFIX ")");
// console title
Utils::Hook::Set<char*>(0x4289E8, "IW4x (r" REVISION_STR "): Console");
Utils::Hook::Set<char*>(0x4289E8, "IW4x (r" REVISION_STR REVISION_SUFFIX "): Console");
// window title
Utils::Hook::Set<char*>(0x5076A0, "IW4x: Multiplayer");

View File

@ -112,6 +112,11 @@
#define MILESTONE "beta"
#define REVISION_STR STRINGIZE(REVISION)
#if !REVISION_CLEAN
#define REVISION_SUFFIX "*"
#else
#define REVISION_SUFFIX ""
#endif
#define VERSION 4,2,REVISION
#define VERSION_STR "4.2." REVISION_STR