From 4ac3ec8344ac7e7eb476006a4f34e4a9b80f2f4f Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Sun, 8 Jul 2012 13:46:09 -0300 Subject: [PATCH] Minor fixes for releasing otclient --- init.lua | 7 +------ modules/client_background/background.lua | 2 +- src/framework/CMakeLists.txt | 6 +++++- src/framework/application.h | 1 + src/framework/const.h | 6 +++++- src/framework/luafunctions.cpp | 10 +--------- src/framework/platform/unixcrashhandler.cpp | 2 +- src/framework/platform/win32crashhandler.cpp | 2 +- src/main.cpp | 5 +++++ src/otclient/otclient.cpp | 2 +- tools/pkgs/makeotc | 4 +++- 11 files changed, 25 insertions(+), 22 deletions(-) diff --git a/init.lua b/init.lua index 73bb6f26..d6b35ad4 100644 --- a/init.lua +++ b/init.lua @@ -1,16 +1,11 @@ -- this is the first file executed when the application starts -- we have to load the first modules form here --- setup application name and version -g_app.setName('OTClient') -g_app.setCompactName('otclient') -g_app.setVersion('0.5.0_dev') - -- setup logger g_logger.setLogFile(g_resources.getWorkDir() .. g_app.getCompactName() .. ".log") -- print first terminal message -g_logger.info(g_app.getName() .. ' ' .. g_app.getVersion() .. ' (rev ' .. g_app.getBuildRevision() .. ') built on ' .. g_app.getBuildDate()) +g_logger.info(g_app.getName() .. ' ' .. g_app.getVersion() .. ' rev ' .. g_app.getBuildRevision() .. ' (' .. g_app.getBuildCommit() .. ') built on ' .. g_app.getBuildDate()) --add base folder to search path g_resources.addToSearchPath(g_resources.getWorkDir()) diff --git a/modules/client_background/background.lua b/modules/client_background/background.lua index 53d57b7a..6e794ae2 100644 --- a/modules/client_background/background.lua +++ b/modules/client_background/background.lua @@ -10,7 +10,7 @@ function Background.init() local clientVersionLabel = background:getChildById('clientVersionLabel') clientVersionLabel:setText('OTClient ' .. g_app.getVersion() .. '\n' .. - 'Rev ' .. g_app.getBuildRevision() .. '\n' .. + 'Rev ' .. g_app.getBuildRevision() .. ' ('.. g_app.getBuildCommit() .. ')\n' .. 'Protocol ' .. g_game.getProtocolVersion() .. '\n' .. 'Built on ' .. g_app.getBuildDate()) diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index 88203ea6..1136fb99 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -11,7 +11,8 @@ OPTION(LUAJIT "Use lua jit" OFF) OPTION(USE_STATIC_LIBS "Don't use shared libraries (dlls)" ON) SET(OPENGLES "OFF" CACHE "Use OpenGL ES 1.0 or 2.0 (for mobiles devices)" STRING) -SET(BUILD_REVISION "custom" CACHE "Git revision string (intended for releases)" STRING) +SET(BUILD_COMMIT "custom" CACHE "Git commit string (intended for releases)" STRING) +SET(BUILD_REVISION "0" CACHE "Git revision string (intended for releases)" STRING) IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE "RelWithDebInfo") @@ -41,6 +42,9 @@ ENDIF() MESSAGE(STATUS "Build type: " ${CMAKE_BUILD_TYPE}) ADD_DEFINITIONS(-D"BUILD_TYPE=\\\"${CMAKE_BUILD_TYPE}\\\"") +MESSAGE(STATUS "Build commit: ${BUILD_COMMIT}") +ADD_DEFINITIONS(-D"BUILD_COMMIT=\\\"${BUILD_COMMIT}\\\"") + MESSAGE(STATUS "Build revision: ${BUILD_REVISION}") ADD_DEFINITIONS(-D"BUILD_REVISION=\\\"${BUILD_REVISION}\\\"") diff --git a/src/framework/application.h b/src/framework/application.h index 4195435e..d74909c0 100644 --- a/src/framework/application.h +++ b/src/framework/application.h @@ -69,6 +69,7 @@ public: std::string getBuildCompiler() { return BUILD_COMPILER; } std::string getBuildDate() { return BUILD_DATE; } std::string getBuildRevision() { return BUILD_REVISION; } + std::string getBuildCommit() { return BUILD_COMMIT; } std::string getBuildType() { return BUILD_TYPE; } std::string getStartupOptions() { return m_startupOptions; } diff --git a/src/framework/const.h b/src/framework/const.h index 0263a644..cb7f2d2d 100644 --- a/src/framework/const.h +++ b/src/framework/const.h @@ -29,8 +29,12 @@ #define BUILD_COMPILER "gcc " __VERSION__ #define BUILD_DATE __DATE__ + #ifndef BUILD_COMMIT +#define BUILD_COMMIT "custom" +#endif + #ifndef BUILD_REVISION -#define BUILD_REVISION "custom" +#define BUILD_REVISION "0" #endif #ifndef BUILD_TYPE diff --git a/src/framework/luafunctions.cpp b/src/framework/luafunctions.cpp index e19340d4..8890a539 100644 --- a/src/framework/luafunctions.cpp +++ b/src/framework/luafunctions.cpp @@ -499,17 +499,9 @@ void Application::registerLuaFunctions() g_lua.bindSingletonFunction("g_app", "getBuildCompiler", &Application::getBuildCompiler, &g_app); g_lua.bindSingletonFunction("g_app", "getBuildDate", &Application::getBuildDate, &g_app); g_lua.bindSingletonFunction("g_app", "getBuildRevision", &Application::getBuildRevision, &g_app); + g_lua.bindSingletonFunction("g_app", "getBuildCommit", &Application::getBuildCommit, &g_app); g_lua.bindSingletonFunction("g_app", "getBuildType", &Application::getBuildType, &g_app); g_lua.bindSingletonFunction("g_app", "exit", &Application::exit, &g_app); - g_lua.bindSingletonFunction("g_app", "isRunning", &Application::isRunning, &g_app); - g_lua.bindSingletonFunction("g_app", "isStopping", &Application::isStopping, &g_app); - g_lua.bindSingletonFunction("g_app", "getName", &Application::getName, &g_app); - g_lua.bindSingletonFunction("g_app", "getCompactName", &Application::getCompactName, &g_app); - g_lua.bindSingletonFunction("g_app", "getVersion", &Application::getVersion, &g_app); - g_lua.bindSingletonFunction("g_app", "getBuildCompiler", &Application::getBuildCompiler, &g_app); - g_lua.bindSingletonFunction("g_app", "getBuildDate", &Application::getBuildDate, &g_app); - g_lua.bindSingletonFunction("g_app", "getBuildRevision", &Application::getBuildRevision, &g_app); - g_lua.bindSingletonFunction("g_app", "getBuildType", &Application::getBuildType, &g_app); // ConfigManager g_lua.registerSingletonClass("g_configs"); diff --git a/src/framework/platform/unixcrashhandler.cpp b/src/framework/platform/unixcrashhandler.cpp index 7a653be7..95aa4d39 100644 --- a/src/framework/platform/unixcrashhandler.cpp +++ b/src/framework/platform/unixcrashhandler.cpp @@ -46,7 +46,7 @@ void crashHandler(int signum, siginfo_t* info, void* secret) ss << stdext::format("build compiler: %s\n", BUILD_COMPILER); ss << stdext::format("build date: %s\n", BUILD_DATE); ss << stdext::format("build type: %s\n", BUILD_TYPE); - ss << stdext::format("build revision: %s\n", BUILD_REVISION); + ss << stdext::format("build revision: %s (%s)\n", BUILD_REVISION, BUILD_COMMIT); ss << stdext::format("crash date: %s\n", stdext::date_time_string()); ss.flags(std::ios::hex | std::ios::showbase); diff --git a/src/framework/platform/win32crashhandler.cpp b/src/framework/platform/win32crashhandler.cpp index e9be07d4..a6ffe77c 100644 --- a/src/framework/platform/win32crashhandler.cpp +++ b/src/framework/platform/win32crashhandler.cpp @@ -116,7 +116,7 @@ LONG CALLBACK ExceptionHandler(LPEXCEPTION_POINTERS e) ss << stdext::format("build compiler: %s\n", BUILD_COMPILER); ss << stdext::format("build date: %s\n", BUILD_DATE); ss << stdext::format("build type: %s\n", BUILD_TYPE); - ss << stdext::format("build revision: %s\n", BUILD_REVISION); + ss << stdext::format("build revision: %s (%s)\n", BUILD_REVISION, BUILD_COMMIT); ss << stdext::format("crash date: %s\n", stdext::date_time_string().c_str()); ss << stdext::format("exception: %s (0x%08lx)\n", getExceptionName(e->ExceptionRecord->ExceptionCode), e->ExceptionRecord->ExceptionCode); ss << stdext::format("exception address: 0x%08lx\n", (long unsigned int)e->ExceptionRecord->ExceptionAddress); diff --git a/src/main.cpp b/src/main.cpp index 7bd4851e..562a76bf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,6 +29,11 @@ int main(int argc, const char* argv[]) { std::vector args(argv, argv + argc); + // setup application name and version + g_app.setName("OTClient"); + g_app.setCompactName("otclient"); + g_app.setVersion("0.5.0_dev"); + // initialize application framework and otclient g_app.init("otclient", args); g_otclient.init(args); diff --git a/src/otclient/otclient.cpp b/src/otclient/otclient.cpp index b69e3425..50965ac9 100644 --- a/src/otclient/otclient.cpp +++ b/src/otclient/otclient.cpp @@ -49,7 +49,7 @@ void OTClient::init(const std::vector& args) stdext::print( m_appName, " ", m_appVersion, "\n" "Buitt on: ", BUILD_DATE, "\n", - "Revision: ", BUILD_REVISION, "\n", + "Commit: ", BUILD_COMMIT, "\n", "Compiled by: ", BUILD_COMPILER, "\n", "Build type: ", BUILD_TYPE, "\n"); return; diff --git a/tools/pkgs/makeotc b/tools/pkgs/makeotc index 91419e7f..8a5ca344 100755 --- a/tools/pkgs/makeotc +++ b/tools/pkgs/makeotc @@ -34,7 +34,8 @@ else fi gitdir=`pwd` -revision=`git describe --dirty --always` +revision=`git rev-list --all | wc -l` +commit=`git describe --dirty --always` rm -rf build mkdir build @@ -43,6 +44,7 @@ cd build cmake -DCMAKE_TOOLCHAIN_FILE=$gitdir/src/framework/cmake/${platform}_toolchain.cmake \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_REVISION=$revision \ + -DBUILD_COMMIT=$commit \ -DBOT_PROTECTION=OFF \ -DPROTOCOL=$protocol \ .. || exit