Skip to content

Commit 84a6848

Browse files
Timofey Turenkomarkus456
Timofey Turenko
authored andcommitted
Add build information to --version-full
If the Jenkins build information is available, print it in the full version output.
1 parent d764bb9 commit 84a6848

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ if(${MAXSCALE_VERSION} MATCHES "-stable")
162162
endif()
163163
endif()
164164

165+
# Copy cmake_flags, JENKINS_BUILD_TAG, source and value evironmental variables
166+
# into cmake variables. These are used by the build system to store information
167+
# about the packages being built.
168+
set(MAXSCALE_SOURCE "$ENV{source} $ENV{value}")
169+
set(MAXSCALE_CMAKE_FLAGS "$ENV{cmake_flags}")
170+
set(MAXSCALE_JENKINS_BUILD_TAG "$ENV{BUILD_TAG}")
171+
165172
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/server/include)
166173
configure_file(${CMAKE_SOURCE_DIR}/server/include/version.h.in ${CMAKE_BINARY_DIR}/server/include/version.h @ONLY)
167174
configure_file(${CMAKE_SOURCE_DIR}/server/include/gwdirs.h.in ${CMAKE_BINARY_DIR}/server/include/gwdirs.h @ONLY)

server/core/gateway.c

+12
Original file line numberDiff line numberDiff line change
@@ -1341,6 +1341,18 @@ int main(int argc, char **argv)
13411341
case 'V':
13421342
rc = EXIT_SUCCESS;
13431343
printf("MaxScale %s - %s\n", MAXSCALE_VERSION, maxscale_commit);
1344+
if (strcmp(MAXSCALE_SOURCE, " ") != 0)
1345+
{
1346+
printf("Source: %s\n", MAXSCALE_SOURCE);
1347+
}
1348+
if (strcmp(MAXSCALE_CMAKE_FLAGS, "") != 0)
1349+
{
1350+
printf("CMake flags: %s\n", MAXSCALE_CMAKE_FLAGS);
1351+
}
1352+
if (strcmp(MAXSCALE_JENKINS_BUILD_TAG, "") != 0)
1353+
{
1354+
printf("Jenkins build: %s\n", MAXSCALE_JENKINS_BUILD_TAG);
1355+
}
13441356
goto return_main;
13451357

13461358
case 'l':

server/include/version.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#define MAXSCALE_VERSION "@MAXSCALE_VERSION@"
22
#define MAXSCALE_COMMIT "@MAXSCALE_COMMIT@"
3+
#define MAXSCALE_SOURCE "@MAXSCALE_SOURCE@"
4+
#define MAXSCALE_CMAKE_FLAGS "@MAXSCALE_CMAKE_FLAGS@"
5+
#define MAXSCALE_JENKINS_BUILD_TAG "@MAXSCALE_JENKINS_BUILD_TAG@"

0 commit comments

Comments
 (0)