PATCH to indicate RC, Updated Version responses (#1643)

* Use Patch Version to indicate if RC or not. If Patch version == 0 Final Release else RC<Patch> appended

* add defines for NANO_MAJOR_MINOR_VERSION and NANO_MAJOR_MINOR_RC_VERSION

* Revert "add defines for NANO_MAJOR_MINOR_VERSION and NANO_MAJOR_MINOR_RC_VERSION"

This reverts commit 8c569d631146eba1dd30ca18193bfcdaa6c7e8a6.

* use static const char
This commit is contained in:
Russel Waters 2019-01-29 16:26:06 -05:00 committed by GitHub
commit 01f0b860d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 59 additions and 15 deletions

View file

@ -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)

View file

@ -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"

View file

@ -27,5 +27,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)

View file

@ -1748,7 +1748,14 @@ TEST (rpc, version)
ASSERT_EQ (std::to_string (node1->store.version_get (transaction)), response1.json.get<std::string> ("store_version"));
}
ASSERT_EQ (std::to_string (nano::protocol_version), response1.json.get<std::string> ("protocol_version"));
ASSERT_EQ (boost::str (boost::format ("Nano %1%.%2%") % NANO_VERSION_MAJOR % NANO_VERSION_MINOR), response1.json.get<std::string> ("node_vendor"));
if (NANO_VERSION_PATCH == 0)
{
ASSERT_EQ (boost::str (boost::format ("Nano %1%") % NANO_MAJOR_MINOR_VERSION), response1.json.get<std::string> ("node_vendor"));
}
else
{
ASSERT_EQ (boost::str (boost::format ("Nano %1%") % NANO_MAJOR_MINOR_RC_VERSION), response1.json.get<std::string> ("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"));

View file

@ -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

View file

@ -826,7 +826,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
{

View file

@ -72,4 +72,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})

View file

@ -1971,7 +1971,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 ())
{

View file

@ -24,6 +24,15 @@
#include <boost/multi_index_container.hpp>
#include <boost/thread/thread.hpp>
#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;

View file

@ -3231,7 +3231,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 ();
}

View file

@ -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);