rippled
BuildInfo.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #include <ripple/basics/contract.h>
21 #include <ripple/beast/core/SemanticVersion.h>
22 #include <ripple/protocol/BuildInfo.h>
23 
24 #include <boost/preprocessor/stringize.hpp>
25 
26 namespace ripple {
27 
28 namespace BuildInfo {
29 
30 //--------------------------------------------------------------------------
31 // The build version number. You must edit this for each release
32 // and follow the format described at http://semver.org/
33 //------------------------------------------------------------------------------
34 // clang-format off
35 char const* const versionString = "1.6.0-b3"
36 // clang-format on
37 
38 #if defined(DEBUG) || defined(SANITIZER)
39  "+"
40 #ifdef DEBUG
41  "DEBUG"
42 #ifdef SANITIZER
43  "."
44 #endif
45 #endif
46 
47 #ifdef SANITIZER
48  BOOST_PP_STRINGIZE(SANITIZER)
49 #endif
50 #endif
51 
52  //--------------------------------------------------------------------------
53  ;
54 
55 //
56 // Don't touch anything below this line
57 //
58 
59 std::string const&
61 {
62  static std::string const value = [] {
63  std::string const s = versionString;
65  if (!v.parse(s) || v.print() != s)
66  LogicError(s + ": Bad server version string");
67  return s;
68  }();
69  return value;
70 }
71 
72 std::string const&
74 {
75  static std::string const value = "rippled-" + getVersionString();
76  return value;
77 }
78 
79 } // namespace BuildInfo
80 
81 } // namespace ripple
std::string
STL class.
beast::SemanticVersion::print
std::string print() const
Produce a string from semantic version components.
Definition: SemanticVersion.cpp:236
beast::SemanticVersion
A Semantic Version number.
Definition: SemanticVersion.h:35
ripple::BuildInfo::getVersionString
std::string const & getVersionString()
Server version.
Definition: BuildInfo.cpp:60
ripple::BuildInfo::getFullVersionString
std::string const & getFullVersionString()
Full server version string.
Definition: BuildInfo.cpp:73
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
beast::SemanticVersion::parse
bool parse(std::string const &input)
Parse a semantic version string.
Definition: SemanticVersion.cpp:168
ripple::BuildInfo::versionString
char const *const versionString
Definition: BuildInfo.cpp:35
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:48