From 2e7b4af8bf8f79a9b66e0e12d0c5ee0d9f6d007b Mon Sep 17 00:00:00 2001 From: Marcos Bento Date: Thu, 27 Feb 2025 14:45:17 +0000 Subject: [PATCH] Rename Version to ..[] --- libs/core/src/ecflow/core/Version.cpp | 50 ++++++++----------- libs/core/src/ecflow/core/Version.hpp | 21 +++----- libs/core/src/ecflow/core/ecflow_version.h.in | 10 ++-- libs/core/test/TestVersion.cpp | 4 +- 4 files changed, 36 insertions(+), 49 deletions(-) diff --git a/libs/core/src/ecflow/core/Version.cpp b/libs/core/src/ecflow/core/Version.cpp index 504a6e0e2..0d9db401a 100644 --- a/libs/core/src/ecflow/core/Version.cpp +++ b/libs/core/src/ecflow/core/Version.cpp @@ -20,9 +20,24 @@ namespace ecf { +std::string Version::major() { + return ECFLOW_VERSION_MAJOR; +} + +std::string Version::minor() { + return ECFLOW_VERSION_MINOR; +} + +std::string Version::patch() { + return ECFLOW_VERSION_PATCH; +} + +std::string Version::suffix() { + return ECFLOW_VERSION_SUFFIX; +}; + std::string Version::description() { std::stringstream ss; - ss << "Ecflow "; #ifdef DEBUG ss << "(debug) "; @@ -38,41 +53,18 @@ std::string Version::description() { return ss.str(); } -std::string Version::version() { - std::string ret = "ecflow_"; - ret += ecf::convert_to(ECFLOW_RELEASE); - ret += "_"; - ret += ecf::convert_to(ECFLOW_MAJOR); - ret += "_"; - ret += ecf::convert_to(ECFLOW_MINOR); - return ret; -} - -std::string Version::raw() { - std::string ret = ecf::convert_to(ECFLOW_RELEASE); +std::string Version::base() { + std::string ret = major(); ret += "."; - ret += ecf::convert_to(ECFLOW_MAJOR); + ret += minor(); ret += "."; - ret += ecf::convert_to(ECFLOW_MINOR); + ret += patch(); return ret; } std::string Version::full() { - return Version::raw() + Version::suffix(); -} - -std::string Version::major() { - return ecf::convert_to(ECFLOW_RELEASE); + return Version::base() + Version::suffix(); } -std::string Version::minor() { - return ecf::convert_to(ECFLOW_MAJOR); -} -std::string Version::patch() { - return ecf::convert_to(ECFLOW_MINOR); -} -std::string Version::suffix() { - return ecf::convert_to(ECFLOW_SUFFIX); -}; std::string Version::boost() { std::stringstream ss; diff --git a/libs/core/src/ecflow/core/Version.hpp b/libs/core/src/ecflow/core/Version.hpp index b61d2cd3f..a645fa3ea 100644 --- a/libs/core/src/ecflow/core/Version.hpp +++ b/libs/core/src/ecflow/core/Version.hpp @@ -31,6 +31,11 @@ class Version { Version(const Version&) = delete; const Version& operator=(const Version&) = delete; + static std::string major(); + static std::string minor(); + static std::string patch(); + static std::string suffix(); + /// /// Creates a string with a descriptive version information, /// including the version of ecFlow and relevant dependencies. @@ -41,25 +46,15 @@ class Version { static std::string description(); /// - /// Creates the ecFlow version, following the template: `ecflow___` + /// Creates the ecFlow version, following the template: `..` /// - static std::string version(); + static std::string base(); /// - /// Creates the ecFlow version, following the template: `..` - /// - static std::string raw(); - - /// - /// Creates the ecFlow version, following the template: `..[]` + /// Creates the ecFlow version, following the template: `..[]` /// static std::string full(); - static std::string major(); - static std::string minor(); - static std::string patch(); - static std::string suffix(); - private: /// Create a string containing the version of the Boost library static std::string boost(); diff --git a/libs/core/src/ecflow/core/ecflow_version.h.in b/libs/core/src/ecflow/core/ecflow_version.h.in index df75df5e6..5d3e6df3a 100644 --- a/libs/core/src/ecflow/core/ecflow_version.h.in +++ b/libs/core/src/ecflow/core/ecflow_version.h.in @@ -12,11 +12,11 @@ #define ecflow_core_ecflow_version_config_H // clang-format off -#define ECFLOW_VERSION "@ecflow_VERSION@" -#define ECFLOW_RELEASE "@ecflow_VERSION_MAJOR@" -#define ECFLOW_MAJOR "@ecflow_VERSION_MINOR@" -#define ECFLOW_MINOR "@ecflow_VERSION_PATCH@" -#define ECFLOW_SUFFIX "@ecflow_VERSION_SUFFIX@" +#define ECFLOW_VERSION "@ecflow_VERSION@" +#define ECFLOW_VERSION_MAJOR "@ecflow_VERSION_MAJOR@" +#define ECFLOW_VERSION_MINOR "@ecflow_VERSION_MINOR@" +#define ECFLOW_VERSION_PATCH "@ecflow_VERSION_PATCH@" +#define ECFLOW_VERSION_SUFFIX "@ecflow_VERSION_SUFFIX@" // available but not used // PROJECT_VERSION=@PROJECT_VERSION@ diff --git a/libs/core/test/TestVersion.cpp b/libs/core/test/TestVersion.cpp index 871768a1a..afd415100 100644 --- a/libs/core/test/TestVersion.cpp +++ b/libs/core/test/TestVersion.cpp @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(test_version) { BOOST_AUTO_TEST_CASE(test_version_raw_components) { ECF_NAME_THIS_TEST(); - auto actual = Version::raw(); + auto actual = Version::base(); auto expected = Version::major() + "." + Version::minor() + "." + Version::patch(); BOOST_CHECK_EQUAL(actual, expected); } @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE(test_version_against_cmake) { auto actual_version = find_cmake_version(lines); BOOST_CHECK_MESSAGE(!actual_version.empty(), "Unable to find CMake version in file " << version_cmake_file); - auto expected_version = Version::raw(); + auto expected_version = Version::base(); BOOST_CHECK_EQUAL(actual_version, expected_version); }