Minor fixes for releasing otclient

This commit is contained in:
Eduardo Bart 2012-07-08 13:46:09 -03:00
parent 7e96c3bec6
commit 4ac3ec8344
11 changed files with 25 additions and 22 deletions

View File

@ -1,16 +1,11 @@
-- this is the first file executed when the application starts -- this is the first file executed when the application starts
-- we have to load the first modules form here -- 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 -- setup logger
g_logger.setLogFile(g_resources.getWorkDir() .. g_app.getCompactName() .. ".log") g_logger.setLogFile(g_resources.getWorkDir() .. g_app.getCompactName() .. ".log")
-- print first terminal message -- 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 --add base folder to search path
g_resources.addToSearchPath(g_resources.getWorkDir()) g_resources.addToSearchPath(g_resources.getWorkDir())

View File

@ -10,7 +10,7 @@ function Background.init()
local clientVersionLabel = background:getChildById('clientVersionLabel') local clientVersionLabel = background:getChildById('clientVersionLabel')
clientVersionLabel:setText('OTClient ' .. g_app.getVersion() .. '\n' .. 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' .. 'Protocol ' .. g_game.getProtocolVersion() .. '\n' ..
'Built on ' .. g_app.getBuildDate()) 'Built on ' .. g_app.getBuildDate())

View File

@ -11,7 +11,8 @@ OPTION(LUAJIT "Use lua jit" OFF)
OPTION(USE_STATIC_LIBS "Don't use shared libraries (dlls)" ON) 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(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) IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "RelWithDebInfo") SET(CMAKE_BUILD_TYPE "RelWithDebInfo")
@ -41,6 +42,9 @@ ENDIF()
MESSAGE(STATUS "Build type: " ${CMAKE_BUILD_TYPE}) MESSAGE(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
ADD_DEFINITIONS(-D"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}") MESSAGE(STATUS "Build revision: ${BUILD_REVISION}")
ADD_DEFINITIONS(-D"BUILD_REVISION=\\\"${BUILD_REVISION}\\\"") ADD_DEFINITIONS(-D"BUILD_REVISION=\\\"${BUILD_REVISION}\\\"")

View File

@ -69,6 +69,7 @@ public:
std::string getBuildCompiler() { return BUILD_COMPILER; } std::string getBuildCompiler() { return BUILD_COMPILER; }
std::string getBuildDate() { return BUILD_DATE; } std::string getBuildDate() { return BUILD_DATE; }
std::string getBuildRevision() { return BUILD_REVISION; } std::string getBuildRevision() { return BUILD_REVISION; }
std::string getBuildCommit() { return BUILD_COMMIT; }
std::string getBuildType() { return BUILD_TYPE; } std::string getBuildType() { return BUILD_TYPE; }
std::string getStartupOptions() { return m_startupOptions; } std::string getStartupOptions() { return m_startupOptions; }

View File

@ -29,8 +29,12 @@
#define BUILD_COMPILER "gcc " __VERSION__ #define BUILD_COMPILER "gcc " __VERSION__
#define BUILD_DATE __DATE__ #define BUILD_DATE __DATE__
#ifndef BUILD_COMMIT
#define BUILD_COMMIT "custom"
#endif
#ifndef BUILD_REVISION #ifndef BUILD_REVISION
#define BUILD_REVISION "custom" #define BUILD_REVISION "0"
#endif #endif
#ifndef BUILD_TYPE #ifndef BUILD_TYPE

View File

@ -499,17 +499,9 @@ void Application::registerLuaFunctions()
g_lua.bindSingletonFunction("g_app", "getBuildCompiler", &Application::getBuildCompiler, &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", "getBuildDate", &Application::getBuildDate, &g_app);
g_lua.bindSingletonFunction("g_app", "getBuildRevision", &Application::getBuildRevision, &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", "getBuildType", &Application::getBuildType, &g_app);
g_lua.bindSingletonFunction("g_app", "exit", &Application::exit, &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 // ConfigManager
g_lua.registerSingletonClass("g_configs"); g_lua.registerSingletonClass("g_configs");

View File

@ -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 compiler: %s\n", BUILD_COMPILER);
ss << stdext::format("build date: %s\n", BUILD_DATE); ss << stdext::format("build date: %s\n", BUILD_DATE);
ss << stdext::format("build type: %s\n", BUILD_TYPE); 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 << stdext::format("crash date: %s\n", stdext::date_time_string());
ss.flags(std::ios::hex | std::ios::showbase); ss.flags(std::ios::hex | std::ios::showbase);

View File

@ -116,7 +116,7 @@ LONG CALLBACK ExceptionHandler(LPEXCEPTION_POINTERS e)
ss << stdext::format("build compiler: %s\n", BUILD_COMPILER); ss << stdext::format("build compiler: %s\n", BUILD_COMPILER);
ss << stdext::format("build date: %s\n", BUILD_DATE); ss << stdext::format("build date: %s\n", BUILD_DATE);
ss << stdext::format("build type: %s\n", BUILD_TYPE); 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("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: %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); ss << stdext::format("exception address: 0x%08lx\n", (long unsigned int)e->ExceptionRecord->ExceptionAddress);

View File

@ -29,6 +29,11 @@ int main(int argc, const char* argv[])
{ {
std::vector<std::string> args(argv, argv + argc); std::vector<std::string> 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 // initialize application framework and otclient
g_app.init("otclient", args); g_app.init("otclient", args);
g_otclient.init(args); g_otclient.init(args);

View File

@ -49,7 +49,7 @@ void OTClient::init(const std::vector<std::string>& args)
stdext::print( stdext::print(
m_appName, " ", m_appVersion, "\n" m_appName, " ", m_appVersion, "\n"
"Buitt on: ", BUILD_DATE, "\n", "Buitt on: ", BUILD_DATE, "\n",
"Revision: ", BUILD_REVISION, "\n", "Commit: ", BUILD_COMMIT, "\n",
"Compiled by: ", BUILD_COMPILER, "\n", "Compiled by: ", BUILD_COMPILER, "\n",
"Build type: ", BUILD_TYPE, "\n"); "Build type: ", BUILD_TYPE, "\n");
return; return;

View File

@ -34,7 +34,8 @@ else
fi fi
gitdir=`pwd` gitdir=`pwd`
revision=`git describe --dirty --always` revision=`git rev-list --all | wc -l`
commit=`git describe --dirty --always`
rm -rf build rm -rf build
mkdir build mkdir build
@ -43,6 +44,7 @@ cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$gitdir/src/framework/cmake/${platform}_toolchain.cmake \ cmake -DCMAKE_TOOLCHAIN_FILE=$gitdir/src/framework/cmake/${platform}_toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DBUILD_REVISION=$revision \ -DBUILD_REVISION=$revision \
-DBUILD_COMMIT=$commit \
-DBOT_PROTECTION=OFF \ -DBOT_PROTECTION=OFF \
-DPROTOCOL=$protocol \ -DPROTOCOL=$protocol \
.. || exit .. || exit