Add build information to --version-full

If the Jenkins build information is available, print it in the full
version output.
This commit is contained in:
Timofey Turenko 2017-02-20 13:41:51 +02:00 committed by Markus Mäkelä
parent d764bb9e1f
commit 84a6848f10
3 changed files with 22 additions and 0 deletions

View File

@ -162,6 +162,13 @@ if(${MAXSCALE_VERSION} MATCHES "-stable")
endif()
endif()
# Copy cmake_flags, JENKINS_BUILD_TAG, source and value evironmental variables
# into cmake variables. These are used by the build system to store information
# about the packages being built.
set(MAXSCALE_SOURCE "$ENV{source} $ENV{value}")
set(MAXSCALE_CMAKE_FLAGS "$ENV{cmake_flags}")
set(MAXSCALE_JENKINS_BUILD_TAG "$ENV{BUILD_TAG}")
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/server/include)
configure_file(${CMAKE_SOURCE_DIR}/server/include/version.h.in ${CMAKE_BINARY_DIR}/server/include/version.h @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/server/include/gwdirs.h.in ${CMAKE_BINARY_DIR}/server/include/gwdirs.h @ONLY)

View File

@ -1341,6 +1341,18 @@ int main(int argc, char **argv)
case 'V':
rc = EXIT_SUCCESS;
printf("MaxScale %s - %s\n", MAXSCALE_VERSION, maxscale_commit);
if (strcmp(MAXSCALE_SOURCE, " ") != 0)
{
printf("Source: %s\n", MAXSCALE_SOURCE);
}
if (strcmp(MAXSCALE_CMAKE_FLAGS, "") != 0)
{
printf("CMake flags: %s\n", MAXSCALE_CMAKE_FLAGS);
}
if (strcmp(MAXSCALE_JENKINS_BUILD_TAG, "") != 0)
{
printf("Jenkins build: %s\n", MAXSCALE_JENKINS_BUILD_TAG);
}
goto return_main;
case 'l':

View File

@ -1,2 +1,5 @@
#define MAXSCALE_VERSION "@MAXSCALE_VERSION@"
#define MAXSCALE_COMMIT "@MAXSCALE_COMMIT@"
#define MAXSCALE_SOURCE "@MAXSCALE_SOURCE@"
#define MAXSCALE_CMAKE_FLAGS "@MAXSCALE_CMAKE_FLAGS@"
#define MAXSCALE_JENKINS_BUILD_TAG "@MAXSCALE_JENKINS_BUILD_TAG@"