From f5110209f7abc2c4508fb55bc74d342eb868a718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 5 Jul 2018 10:57:09 +0300 Subject: [PATCH] MXS-1942: Use MaxScale version in MaxCtrl Displaying the MaxScale version helps identify which package the executable was bundled with. As the MaxCtrl source is a part of MaxScale, there's no need for separate versioning. --- maxctrl/CMakeLists.txt | 3 +++ maxctrl/lib/core.js | 4 +++- maxctrl/lib/version.js.in | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 maxctrl/lib/version.js.in diff --git a/maxctrl/CMakeLists.txt b/maxctrl/CMakeLists.txt index 3105cb14e..67fe828e0 100644 --- a/maxctrl/CMakeLists.txt +++ b/maxctrl/CMakeLists.txt @@ -3,6 +3,9 @@ if (BUILD_MAXCTRL) find_package(NodeJS) if (NPM_FOUND AND NODEJS_FOUND AND NODEJS_VERSION VERSION_GREATER "6.0.0") + + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lib/version.js.in ${CMAKE_CURRENT_BINARY_DIR}/lib/version.js @ONLY) + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/maxctrl/maxctrl COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build.sh ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) diff --git a/maxctrl/lib/core.js b/maxctrl/lib/core.js index 9c0a5a472..8cae23a53 100644 --- a/maxctrl/lib/core.js +++ b/maxctrl/lib/core.js @@ -14,7 +14,9 @@ var fs = require('fs') var program = require('yargs'); -const maxctrl_version = '1.0.0'; +// Note: The version.js file is generated at configuation time. If you are +// building in-source, manually create the file +const maxctrl_version = require('./version.js').version; program .version(maxctrl_version) diff --git a/maxctrl/lib/version.js.in b/maxctrl/lib/version.js.in new file mode 100644 index 000000000..33a73eab9 --- /dev/null +++ b/maxctrl/lib/version.js.in @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2016 MariaDB Corporation Ab + * + * Use of this software is governed by the Business Source License included + * in the LICENSE.TXT file and at www.mariadb.com/bsl11. + * + * Change Date: 2020-01-01 + * + * On the date above, in accordance with the Business Source License, use + * of this software will be governed by version 2 or later of the General + * Public License. + */ + +exports.version = "@MAXSCALE_VERSION@"