[General]: Update build.yml (#959)
This commit is contained in:
parent
aa3f0d414a
commit
63711ddd51
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
- Release
|
||||
steps:
|
||||
- name: Check out files
|
||||
uses: actions/checkout@v3.3.0
|
||||
uses: actions/checkout@v3.5.2
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
@ -72,7 +72,7 @@ jobs:
|
||||
|
||||
# Set up committer info and GPG key
|
||||
- name: Install SSH key
|
||||
uses: shimataro/ssh-key-action@v2.5.0
|
||||
uses: shimataro/ssh-key-action@v2.5.1
|
||||
with:
|
||||
key: ${{ secrets.XLABS_MASTER_SSH_PRIVATE_KEY }}
|
||||
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
|
||||
|
41
premake5.lua
41
premake5.lua
@ -17,19 +17,6 @@ function cstrquote(value)
|
||||
return result
|
||||
end
|
||||
|
||||
-- Converts tags in "vX.X.X" format to an array of numbers {X,X,X}.
|
||||
-- In the case where the format does not work fall back to old {4,2,REVISION}.
|
||||
function vertonumarr(value, vernumber)
|
||||
vernum = {}
|
||||
for num in string.gmatch(value, "%d+") do
|
||||
table.insert(vernum, tonumber(num))
|
||||
end
|
||||
if #vernum < 3 then
|
||||
return {4,2,tonumber(vernumber)}
|
||||
end
|
||||
return vernum
|
||||
end
|
||||
|
||||
dependencies = {
|
||||
basePath = "./deps"
|
||||
}
|
||||
@ -108,7 +95,7 @@ newaction {
|
||||
|
||||
newaction {
|
||||
trigger = "generate-buildinfo",
|
||||
description = "Sets up build information file like version.h.",
|
||||
description = "Sets up build information file. Output will be stored in version.h.",
|
||||
onWorkspace = function(wks)
|
||||
-- get revision number via git
|
||||
local proc = assert(io.popen("git rev-list --count HEAD", "r"))
|
||||
@ -129,6 +116,26 @@ newaction {
|
||||
proc = assert(io.popen("git describe --tags --abbrev=0"))
|
||||
local tagName = assert(proc:read('*l'))
|
||||
|
||||
-- get current branch name
|
||||
proc = assert(io.popen("git branch --show-current"))
|
||||
local branchName = proc:read('*l')
|
||||
|
||||
-- branch for ci
|
||||
if branchName == nil or branchName == '' then
|
||||
proc = assert(io.popen("git show -s --pretty=%d HEAD"))
|
||||
local branchInfo = proc:read('*l')
|
||||
m = string.match(branchInfo, ".+,.+, ([^)]+)")
|
||||
if m ~= nil then
|
||||
branchName = m
|
||||
end
|
||||
end
|
||||
|
||||
if branchName == nil then
|
||||
branchName = "develop"
|
||||
end
|
||||
|
||||
print("Detected branch: " .. branchName)
|
||||
|
||||
-- get old version number from version.hpp if any
|
||||
local oldVersion = "(none)"
|
||||
local oldVersionHeader = io.open(wks.location .. "/src/version.h", "r")
|
||||
@ -157,10 +164,16 @@ newaction {
|
||||
versionHeader:write("#define GIT_DESCRIBE " .. gitDescribeOutputQuoted .. "\n")
|
||||
versionHeader:write("#define GIT_DIRTY " .. revDirty .. "\n")
|
||||
versionHeader:write("#define GIT_TAG " .. cstrquote(tagName) .. "\n")
|
||||
versionHeader:write("#define GIT_BRANCH " .. cstrquote(branchName) .. "\n")
|
||||
versionHeader:write("\n")
|
||||
versionHeader:write("// New revision definition. Will be used from now on\n")
|
||||
versionHeader:write("#define REVISION " .. revNumber .. "\n")
|
||||
versionHeader:write("#define REVISION_STR \"r" .. revNumber .. "\"\n")
|
||||
|
||||
if branchName == "develop" then
|
||||
versionHeader:write("#define EXPERIMENTAL_BUILD" .. "\n")
|
||||
end
|
||||
|
||||
versionHeader:write("\n")
|
||||
versionHeader:write("// Alias definitions\n")
|
||||
versionHeader:write("#define VERSION GIT_DESCRIBE\n")
|
||||
|
@ -48,7 +48,11 @@ namespace Components
|
||||
|
||||
const char* Branding::GetBuildNumber()
|
||||
{
|
||||
#ifdef EXPERIMENTAL_BUILD
|
||||
return REVISION_STR "-develop latest " __DATE__ " " __TIME__;
|
||||
#else
|
||||
return REVISION_STR " latest " __DATE__ " " __TIME__;
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* Branding::GetVersionString()
|
||||
@ -97,14 +101,22 @@ namespace Components
|
||||
RegisterBrandingDvars();
|
||||
|
||||
// UI version string
|
||||
#ifdef EXPERIMENTAL_BUILD
|
||||
Utils::Hook::Set<const char*>(0x43F73B, "IW4x - " REVISION_STR "-develop");
|
||||
#else
|
||||
Utils::Hook::Set<const char*>(0x43F73B, "IW4x - " REVISION_STR);
|
||||
#endif
|
||||
|
||||
// Short version dvar
|
||||
Utils::Hook::Set<const char*>(0x60BD91, REVISION_STR);
|
||||
|
||||
// Com_Init_Try_Block_Function
|
||||
Utils::Hook::Set<const char*>(0x60BAF4, BUILD_TYPE);
|
||||
#ifdef EXPERIMENTAL_BUILD
|
||||
Utils::Hook::Set<const char*>(0x60BAEf, REVISION_STR "-develop");
|
||||
#else
|
||||
Utils::Hook::Set<const char*>(0x60BAEf, REVISION_STR);
|
||||
#endif
|
||||
Utils::Hook::Set<const char*>(0x60BAE5, __DATE__);
|
||||
|
||||
// G_InitGame
|
||||
@ -133,7 +145,11 @@ namespace Components
|
||||
}
|
||||
else if (Dedicated::IsEnabled())
|
||||
{
|
||||
Utils::Hook::Set<const char*>(0x4289E8, "IW4x (" REVISION_STR "): Dedicated");
|
||||
#ifdef EXPERIMENTAL_BUILD
|
||||
Utils::Hook::Set<const char*>(0x4289E8, "IW4x " REVISION_STR "-develop: Dedicated");
|
||||
#else
|
||||
Utils::Hook::Set<const char*>(0x4289E8, "IW4x " REVISION_STR ": Dedicated");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -96,14 +96,22 @@ namespace Components
|
||||
}
|
||||
else if (IsWindow(GetWindow()) != FALSE)
|
||||
{
|
||||
SetWindowTextA(GetWindow(), Utils::String::VA("IW4x(" REVISION_STR ") : %s", hostname.data()));
|
||||
#ifdef EXPERIMENTAL_BUILD
|
||||
SetWindowTextA(GetWindow(), Utils::String::Format("IW4x " REVISION_STR "-develop : %s", hostname));
|
||||
#else
|
||||
SetWindowTextA(GetWindow(), Utils::String::Format("IW4x " REVISION_STR " : %s", hostname));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void Console::ShowPrompt()
|
||||
{
|
||||
wattron(InputWindow, COLOR_PAIR(10) | A_BOLD);
|
||||
#ifdef EXPERIMENTAL_BUILD
|
||||
wprintw(InputWindow, "%s-develop> ", REVISION_STR);
|
||||
#else
|
||||
wprintw(InputWindow, "%s> ", REVISION_STR);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Console::RefreshOutput()
|
||||
@ -837,7 +845,11 @@ namespace Components
|
||||
AssertOffset(Game::clientUIActive_t, keyCatchers, 0x9B0);
|
||||
|
||||
// Console '%s: %s> ' string
|
||||
#ifdef EXPERIMENTAL_BUILD
|
||||
Utils::Hook::Set<const char*>(0x5A44B4, "IW4x MP: " REVISION_STR "-develop> ");
|
||||
#else
|
||||
Utils::Hook::Set<const char*>(0x5A44B4, "IW4x MP: " REVISION_STR "> ");
|
||||
#endif
|
||||
|
||||
// Patch console color
|
||||
static float consoleColor[] = { 0.70f, 1.00f, 0.00f, 1.00f };
|
||||
|
@ -18,7 +18,12 @@ namespace Components
|
||||
if (Flags::HasFlag("version"))
|
||||
{
|
||||
printf("%s", "IW4x " VERSION " (built " __DATE__ " " __TIME__ ")\n");
|
||||
#ifdef EXPERIMENTAL_BUILD
|
||||
printf("Revision: %i - develop\n", REVISION);
|
||||
#else
|
||||
printf("Revision: %i\n", REVISION);
|
||||
#endif
|
||||
|
||||
ExitProcess(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -90,10 +90,8 @@ namespace Utils::String
|
||||
[[nodiscard]] const char* Format(std::string_view fmt, Args&&... args)
|
||||
{
|
||||
static thread_local std::string vaBuffer;
|
||||
vaBuffer.clear();
|
||||
|
||||
(SanitizeFormatArgs(args), ...);
|
||||
std::vformat_to(std::back_inserter(vaBuffer), fmt, std::make_format_args(args...));
|
||||
std::vformat(fmt, std::make_format_args(args...)).swap(vaBuffer);
|
||||
return vaBuffer.data();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user