summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.gitignore1
-rwxr-xr-xCIbuild.sh4
-rw-r--r--CMakeLists.txt19
-rw-r--r--src/BuildInfo.h.cmake15
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/Root.cpp6
6 files changed, 48 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index a4cbef72f..6afc12116 100644
--- a/.gitignore
+++ b/.gitignore
@@ -56,6 +56,7 @@ Makefile
*.a
*.d
*.so
+BuildInfo.h
CMakeCache.txt
CMakeFiles
Makefile
diff --git a/CIbuild.sh b/CIbuild.sh
index 683c1fc74..df023316e 100755
--- a/CIbuild.sh
+++ b/CIbuild.sh
@@ -2,6 +2,10 @@
set -e
+export BUILD_SERIES_NAME="Travis $CC $TRAVIS_MCSERVER_BUILD_TYPE"
+export BUILD_ID=$TRAVIS_JOB_NUMBER
+export BUILD_DATETIME=`date`
+
cmake . -DBUILD_TOOLS=1 -DSELF_TEST=1;
make -j 2;
make -j 2 test;
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4c47eb509..8f58f157a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,25 @@ if(DEFINED ENV{TRAVIS_BUILD_WITH_COVERAGE})
set(BUILD_WITH_COVERAGE $ENV{TRAVIS_BUILD_WITH_COVERAGE})
endif()
+if(DEFINED ENV{BUILD_ID})
+ set(BUILD_ID $ENV{BUILD_ID})
+ set(BUILD_SERIES_NAME $ENV{BUILD_SERIES_NAME})
+ set(BUILD_DATETIME $ENV{BUILD_DATETIME})
+ if(DEFINED ENV{BUILD_COMMIT_ID})
+ set(BUILD_COMMIT_ID $ENV{BUILD_COMMIT_ID})
+ else()
+ message("Commit id not set, attempting to determine id from git")
+ execute_process(
+ COMMAND git rev-parse HEAD
+ RESULT_VARIABLE GIT_EXECUTED
+ OUTPUT_VARIABLE BUILD_COMMIT_ID)
+ string(STRIP ${BUILD_COMMIT_ID} BUILD_COMMIT_ID)
+ if (NOT (GIT_EXECUTED EQUAL 0))
+ message(FATAL_ERROR "Could not identifiy git commit id")
+ endif()
+ endif()
+endif()
+
# This has to be done before any flags have been set up.
if(${BUILD_TOOLS})
add_subdirectory(Tools/MCADefrag/)
diff --git a/src/BuildInfo.h.cmake b/src/BuildInfo.h.cmake
new file mode 100644
index 000000000..6337dab3e
--- /dev/null
+++ b/src/BuildInfo.h.cmake
@@ -0,0 +1,15 @@
+
+#pragma once
+
+#cmakedefine BUILD_ID
+
+#ifdef BUILD_ID
+
+#undef BUILD_ID
+
+#define BUILD_SERIES_NAME "@BUILD_SERIES_NAME@"
+#define BUILD_ID "@BUILD_ID@"
+#define BUILD_COMMIT_ID "@BUILD_COMMIT_ID@"
+#define BUILD_DATETIME "@BUILD_DATETIME@"
+#endif
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2d96662a9..9d0e2cede 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -75,6 +75,7 @@ SET (HDRS
BlockInfo.h
BlockTracer.h
BoundingBox.h
+ BuildInfo.h.cmake
ByteBuffer.h
ChatColor.h
Chunk.h
@@ -140,6 +141,8 @@ include_directories(".")
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/sqlite")
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/SQLiteCpp/include")
+configure_file("BuildInfo.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/BuildInfo.h")
+
if (NOT MSVC)
# Bindings need to reference other folders, so they are done here instead
# lib dependencies are not included
diff --git a/src/Root.cpp b/src/Root.cpp
index 870662f36..86a497a76 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -18,6 +18,7 @@
#include "DeadlockDetect.h"
#include "OSSupport/Timer.h"
#include "LoggerListeners.h"
+#include "BuildInfo.h"
#include "inifile/iniFile.h"
@@ -111,6 +112,11 @@ void cRoot::Start(void)
LOG("--- Started Log ---\n");
+ #ifdef BUILD_ID
+ LOG("MCServer " BUILD_SERIES_NAME " build id: " BUILD_ID );
+ LOG("from commit id: " BUILD_COMMIT_ID " built at: " BUILD_DATETIME );
+ #endif
+
cDeadlockDetect dd;
m_bStop = false;