diff --git a/CMakeLists.txt b/CMakeLists.txt index 03f47931f3..e6783ec302 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,6 @@ project (nano-node) set (CPACK_PACKAGE_VERSION_MAJOR "18") set (CPACK_PACKAGE_VERSION_MINOR "0") set (CPACK_PACKAGE_VERSION_PATCH "0") -if (DEFINED GIT_COMMIT) - set (CPACK_PACKAGE_VERSION_PATCH "GIT-${GIT_COMMIT}") -endif () set (CPACK_PACKAGE_VENDOR "Nano Currency") set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks") @@ -307,7 +304,8 @@ if (NANO_GUI OR RAIBLOCKS_GUI) target_compile_definitions(qt PRIVATE -DNANO_VERSION_MAJOR=${CPACK_PACKAGE_VERSION_MAJOR} - -DNANO_VERSION_MINOR=${CPACK_PACKAGE_VERSION_MINOR}) + -DNANO_VERSION_MINOR=${CPACK_PACKAGE_VERSION_MINOR} + -DNANO_VERSION_PATCH=${CPACK_PACKAGE_VERSION_PATCH}) if (WIN32) set (PLATFORM_GUI_TARGET_PROPERTIES WIN32) diff --git a/appveyor.yml b/appveyor.yml index a1b50a1634..2f1987c3c4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,11 +13,9 @@ environment: clone_folder: C:\projects\myproject install: - cmd: >- - SET GIT_COMMIT=%APPVEYOR_REPO_COMMIT:~0,3% - git submodule update --init --recursive - cmake -DNANO_GUI=ON -DACTIVE_NETWORK=%NETWORK% -DQt5_DIR="C:\Qt\5.9\msvc2017_64\lib\cmake\Qt5" -DNANO_SIMD_OPTIMIZATIONS=TRUE -DBoost_COMPILER="-vc141" -DBOOST_ROOT="C:/Libraries/boost_1_66_0" -DBOOST_LIBRARYDIR="C:/Libraries/boost_1_66_0/lib64-msvc-14.1" -G "Visual Studio 15 2017 Win64" -DIPHLPAPI_LIBRARY="C:/Program Files (x86)/Windows Kits/10/Lib/10.0.14393.0/um/x64/iphlpapi.lib" -DWINSOCK2_LIBRARY="C:/Program Files (x86)/Windows Kits/10/Lib/10.0.14393.0/um/x64/WS2_32.lib" -DGIT_COMMIT=%GIT_COMMIT% + cmake -DNANO_GUI=ON -DACTIVE_NETWORK=%NETWORK% -DQt5_DIR="C:\Qt\5.9\msvc2017_64\lib\cmake\Qt5" -DNANO_SIMD_OPTIMIZATIONS=TRUE -DBoost_COMPILER="-vc141" -DBOOST_ROOT="C:/Libraries/boost_1_66_0" -DBOOST_LIBRARYDIR="C:/Libraries/boost_1_66_0/lib64-msvc-14.1" -G "Visual Studio 15 2017 Win64" -DIPHLPAPI_LIBRARY="C:/Program Files (x86)/Windows Kits/10/Lib/10.0.14393.0/um/x64/iphlpapi.lib" -DWINSOCK2_LIBRARY="C:/Program Files (x86)/Windows Kits/10/Lib/10.0.14393.0/um/x64/WS2_32.lib" diff --git a/nano/core_test/CMakeLists.txt b/nano/core_test/CMakeLists.txt index 33c49ce401..7ea547ba80 100644 --- a/nano/core_test/CMakeLists.txt +++ b/nano/core_test/CMakeLists.txt @@ -26,5 +26,6 @@ add_executable (core_test target_compile_definitions(core_test PRIVATE -DNANO_VERSION_MAJOR=${CPACK_PACKAGE_VERSION_MAJOR} - -DNANO_VERSION_MINOR=${CPACK_PACKAGE_VERSION_MINOR}) + -DNANO_VERSION_MINOR=${CPACK_PACKAGE_VERSION_MINOR} + -DNANO_VERSION_PATCH=${CPACK_PACKAGE_VERSION_PATCH}) target_link_libraries (core_test node secure gtest_main gtest libminiupnpc-static Boost::boost) diff --git a/nano/core_test/rpc.cpp b/nano/core_test/rpc.cpp index a797958fc1..7b65b930b2 100644 --- a/nano/core_test/rpc.cpp +++ b/nano/core_test/rpc.cpp @@ -1713,7 +1713,14 @@ TEST (rpc, version) ASSERT_EQ (std::to_string (node1->store.version_get (transaction)), response1.json.get ("store_version")); } ASSERT_EQ (std::to_string (nano::protocol_version), response1.json.get ("protocol_version")); - ASSERT_EQ (boost::str (boost::format ("Nano %1%.%2%") % NANO_VERSION_MAJOR % NANO_VERSION_MINOR), response1.json.get ("node_vendor")); + if (NANO_VERSION_PATCH == 0) + { + ASSERT_EQ (boost::str (boost::format ("Nano %1%") % NANO_MAJOR_MINOR_VERSION), response1.json.get ("node_vendor")); + } + else + { + ASSERT_EQ (boost::str (boost::format ("Nano %1%") % NANO_MAJOR_MINOR_RC_VERSION), response1.json.get ("node_vendor")); + } auto headers (response1.resp.base ()); auto allowed_origin (headers.at ("Access-Control-Allow-Origin")); auto allowed_headers (headers.at ("Access-Control-Allow-Headers")); diff --git a/nano/nano_node/CMakeLists.txt b/nano/nano_node/CMakeLists.txt index fa714a6706..4640572fc7 100644 --- a/nano/nano_node/CMakeLists.txt +++ b/nano/nano_node/CMakeLists.txt @@ -14,7 +14,8 @@ target_link_libraries (nano_node target_compile_definitions(nano_node PRIVATE -DNANO_VERSION_MAJOR=${CPACK_PACKAGE_VERSION_MAJOR} - -DNANO_VERSION_MINOR=${CPACK_PACKAGE_VERSION_MINOR}) + -DNANO_VERSION_MINOR=${CPACK_PACKAGE_VERSION_MINOR} + -DNANO_VERSION_PATCH=${CPACK_PACKAGE_VERSION_PATCH}) set_target_properties (nano_node PROPERTIES diff --git a/nano/nano_node/entry.cpp b/nano/nano_node/entry.cpp index 0ec6c7037c..a85578581e 100644 --- a/nano/nano_node/entry.cpp +++ b/nano/nano_node/entry.cpp @@ -815,7 +815,14 @@ int main (int argc, char * const * argv) } else if (vm.count ("version")) { - std::cout << "Version " << NANO_VERSION_MAJOR << "." << NANO_VERSION_MINOR << std::endl; + if (NANO_VERSION_PATCH == 0) + { + std::cout << "Version " << NANO_MAJOR_MINOR_VERSION << std::endl; + } + else + { + std::cout << "Version " << NANO_MAJOR_MINOR_RC_VERSION << std::endl; + } } else { diff --git a/nano/node/CMakeLists.txt b/nano/node/CMakeLists.txt index 07397c091e..6d106138d5 100644 --- a/nano/node/CMakeLists.txt +++ b/nano/node/CMakeLists.txt @@ -70,4 +70,5 @@ target_link_libraries (node target_compile_definitions(node PRIVATE -DNANO_VERSION_MAJOR=${CPACK_PACKAGE_VERSION_MAJOR} - -DNANO_VERSION_MINOR=${CPACK_PACKAGE_VERSION_MINOR}) + -DNANO_VERSION_MINOR=${CPACK_PACKAGE_VERSION_MINOR} + -DNANO_VERSION_PATCH=${CPACK_PACKAGE_VERSION_PATCH}) diff --git a/nano/node/node.cpp b/nano/node/node.cpp index 3c7df81f7c..de488134f6 100644 --- a/nano/node/node.cpp +++ b/nano/node/node.cpp @@ -1748,7 +1748,15 @@ startup_time (std::chrono::steady_clock::now ()) } } }); - BOOST_LOG (log) << "Node starting, version: " << NANO_VERSION_MAJOR << "." << NANO_VERSION_MINOR; + if (NANO_VERSION_PATCH == 0) + { + BOOST_LOG (log) << "Node starting, version: " << NANO_MAJOR_MINOR_VERSION; + } + else + { + BOOST_LOG (log) << "Node starting, version: " << NANO_MAJOR_MINOR_RC_VERSION; + } + BOOST_LOG (log) << boost::str (boost::format ("Work pool running %1% threads") % work.threads.size ()); if (!init_a.error ()) { diff --git a/nano/node/node.hpp b/nano/node/node.hpp index 5400ce04fd..af919557db 100644 --- a/nano/node/node.hpp +++ b/nano/node/node.hpp @@ -21,6 +21,15 @@ #include #include +#define xstr(a) ver_str (a) +#define ver_str(a) #a + +/** +* Returns build version information +*/ +static const char * NANO_MAJOR_MINOR_VERSION = xstr (NANO_VERSION_MAJOR) "." xstr (NANO_VERSION_MINOR); +static const char * NANO_MAJOR_MINOR_RC_VERSION = xstr (NANO_VERSION_MAJOR) "." xstr (NANO_VERSION_MINOR) "RC" xstr (NANO_VERSION_PATCH); + namespace nano { class node; diff --git a/nano/node/rpc.cpp b/nano/node/rpc.cpp index 1c15843374..bf9d6cb531 100644 --- a/nano/node/rpc.cpp +++ b/nano/node/rpc.cpp @@ -3094,7 +3094,14 @@ void nano::rpc_handler::version () response_l.put ("rpc_version", "1"); response_l.put ("store_version", std::to_string (node.store_version ())); response_l.put ("protocol_version", std::to_string (nano::protocol_version)); - response_l.put ("node_vendor", boost::str (boost::format ("Nano %1%.%2%") % NANO_VERSION_MAJOR % NANO_VERSION_MINOR)); + if (NANO_VERSION_PATCH == 0) + { + response_l.put ("node_vendor", boost::str (boost::format ("Nano %1%") % NANO_MAJOR_MINOR_VERSION)); + } + else + { + response_l.put ("node_vendor", boost::str (boost::format ("Nano %1%") % NANO_MAJOR_MINOR_RC_VERSION)); + } response_errors (); } diff --git a/nano/qt/qt.cpp b/nano/qt/qt.cpp index 6570fb86d8..d4b7488f1a 100644 --- a/nano/qt/qt.cpp +++ b/nano/qt/qt.cpp @@ -81,7 +81,14 @@ wallet (wallet_a) { network = "Test"; } - version = new QLabel (boost::str (boost::format ("Version %1%.%2% %3% network") % NANO_VERSION_MAJOR % NANO_VERSION_MINOR % network).c_str ()); + if (NANO_VERSION_PATCH == 0) + { + version = new QLabel (boost::str (boost::format ("Version %1% %2% network") % NANO_MAJOR_MINOR_VERSION % network).c_str ()); + } + else + { + version = new QLabel (boost::str (boost::format ("Version %1% %2% network") % NANO_MAJOR_MINOR_RC_VERSION % network).c_str ()); + } self_layout->addWidget (your_account_label); self_layout->addStretch (); self_layout->addWidget (version);