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:
commit
db837b6168
@ -18,7 +18,6 @@ exit /B 1
|
|||||||
:build
|
:build
|
||||||
set PLATFORM=Win32
|
set PLATFORM=Win32
|
||||||
set CONFIGURATION=ReleaseStatic
|
set CONFIGURATION=ReleaseStatic
|
||||||
call generate
|
|
||||||
msbuild /nologo /m /v:m %* build\iw4x.sln
|
msbuild /nologo /m /v:m %* build\iw4x.sln
|
||||||
endlocal
|
endlocal
|
||||||
exit /B %ERRORLEVEL%
|
exit /B %ERRORLEVEL%
|
||||||
|
29
premake5.lua
29
premake5.lua
@ -33,8 +33,20 @@ newaction {
|
|||||||
local revNumber = assert(proc:read('*a')):gsub("%s+", "")
|
local revNumber = assert(proc:read('*a')):gsub("%s+", "")
|
||||||
proc:close()
|
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
|
-- get old version number from version.hpp if any
|
||||||
local oldRevNumber = "(none)"
|
local oldRevNumber = "(none)"
|
||||||
|
local oldRevClean = 1
|
||||||
|
local oldRevCleanSuffix = ""
|
||||||
local oldVersionHeader = io.open(wks.location .. "/src/version.hpp", "r")
|
local oldVersionHeader = io.open(wks.location .. "/src/version.hpp", "r")
|
||||||
if oldVersionHeader ~=nil then
|
if oldVersionHeader ~=nil then
|
||||||
local oldVersionHeaderContent = assert(oldVersionHeader:read('*a'))
|
local oldVersionHeaderContent = assert(oldVersionHeader:read('*a'))
|
||||||
@ -43,11 +55,23 @@ newaction {
|
|||||||
-- old version.hpp format?
|
-- old version.hpp format?
|
||||||
oldRevNumber = "(none)"
|
oldRevNumber = "(none)"
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
-- generate version.hpp with a revision number if not equal
|
-- generate version.hpp with a revision number if not equal
|
||||||
if oldRevNumber ~= revNumber then
|
if oldRevNumber ~= revNumber or oldRevClean ~= revClean then
|
||||||
print ("Update " .. oldRevNumber .. " -> " .. revNumber)
|
print ("Update " .. oldRevNumber .. oldRevCleanSuffix .. " -> " .. revNumber .. revCleanSuffix)
|
||||||
local versionHeader = assert(io.open(wks.location .. "/src/version.hpp", "w"))
|
local versionHeader = assert(io.open(wks.location .. "/src/version.hpp", "w"))
|
||||||
versionHeader:write("/*\n")
|
versionHeader:write("/*\n")
|
||||||
versionHeader:write(" * Automatically generated by premake5.\n")
|
versionHeader:write(" * Automatically generated by premake5.\n")
|
||||||
@ -55,6 +79,7 @@ newaction {
|
|||||||
versionHeader:write(" */\n")
|
versionHeader:write(" */\n")
|
||||||
versionHeader:write("\n")
|
versionHeader:write("\n")
|
||||||
versionHeader:write("#define REVISION " .. revNumber .. "\n")
|
versionHeader:write("#define REVISION " .. revNumber .. "\n")
|
||||||
|
versionHeader:write("#define REVISION_CLEAN " .. revClean .. "\n")
|
||||||
versionHeader:close()
|
versionHeader:close()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -118,16 +118,16 @@ namespace Components
|
|||||||
Utils::Hook::Set<char*>(0x6431D1, BASEGAME);
|
Utils::Hook::Set<char*>(0x6431D1, BASEGAME);
|
||||||
|
|
||||||
// UI version string
|
// 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
|
// 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
|
// version string
|
||||||
Utils::Hook::Set<char*>(0x60BD56, "IW4x (r" REVISION_STR ")");
|
Utils::Hook::Set<char*>(0x60BD56, "IW4x (r" REVISION_STR REVISION_SUFFIX ")");
|
||||||
|
|
||||||
// console title
|
// 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
|
// window title
|
||||||
Utils::Hook::Set<char*>(0x5076A0, "IW4x: Multiplayer");
|
Utils::Hook::Set<char*>(0x5076A0, "IW4x: Multiplayer");
|
||||||
|
@ -112,6 +112,11 @@
|
|||||||
#define MILESTONE "beta"
|
#define MILESTONE "beta"
|
||||||
|
|
||||||
#define REVISION_STR STRINGIZE(REVISION)
|
#define REVISION_STR STRINGIZE(REVISION)
|
||||||
|
#if !REVISION_CLEAN
|
||||||
|
#define REVISION_SUFFIX "*"
|
||||||
|
#else
|
||||||
|
#define REVISION_SUFFIX ""
|
||||||
|
#endif
|
||||||
#define VERSION 4,2,REVISION
|
#define VERSION 4,2,REVISION
|
||||||
#define VERSION_STR "4.2." REVISION_STR
|
#define VERSION_STR "4.2." REVISION_STR
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user