From 41a3418b7b21160133b76c71f3cf019cdb8d823a Mon Sep 17 00:00:00 2001 From: Alex Melman Date: Sat, 27 Feb 2021 14:34:41 +0200 Subject: [PATCH] Adds command line parameter -V that shows build version to the binaries. Build number controlled in top level CMakeLists.txt file via -DBUILD_VERSION variable. Usage: adnl-pong -V validator-engine -V and so on. --- CMakeLists.txt | 4 ++- adnl/adnl-pong.cpp | 20 ++++++++----- adnl/adnl-proxy.cpp | 20 ++++++++----- create-hardfork/create-hardfork.cpp | 20 ++++++++----- crypto/block/create-state.cpp | 25 +++++++++------- crypto/block/dump-block.cpp | 27 ++++++++++------- crypto/fift/fift-main.cpp | 26 ++++++++++------- crypto/func/func.cpp | 29 +++++++++++-------- dht-server/dht-server.cpp | 20 ++++++++----- http/http-proxy.cpp | 4 +++ lite-client/lite-client.cpp | 20 ++++++++----- rldp-http-proxy/rldp-http-proxy.cpp | 20 ++++++++----- tonlib/tonlib/tonlib-cli.cpp | 4 +++ utils/generate-random-id.cpp | 20 ++++++++----- utils/json2tlo.cpp | 20 ++++++++----- .../validator-engine-console.cpp | 20 ++++++++----- validator-engine/validator-engine.cpp | 20 ++++++++----- 17 files changed, 195 insertions(+), 124 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc833562..cb0dd1e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,8 @@ project(TON VERSION 0.5 LANGUAGES C CXX) set(CMAKE_POSITION_INDEPENDENT_CODE ON) #set(OPENSSL_USE_STATIC_LIBS TRUE) +ADD_DEFINITIONS( -DBUILD_VERSION=\"3.0.0\" ) + # Prevent in-source build get_filename_component(TON_REAL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" REALPATH) get_filename_component(TON_REAL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" REALPATH) @@ -112,7 +114,7 @@ add_subdirectory(third-party/crc32c EXCLUDE_FROM_ALL) set(CRC32C_FOUND 1) if (TON_USE_ROCKSDB) - if (ANDROID) + if (ANDROID) set(PORTABLE ON CACHE BOOL "portable") endif() set(WITH_GFLAGS OFF CACHE BOOL "build with GFlags") diff --git a/adnl/adnl-pong.cpp b/adnl/adnl-pong.cpp index e04e82ba..d9e869df 100644 --- a/adnl/adnl-pong.cpp +++ b/adnl/adnl-pong.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2017-2020 Telegram Systems LLP @@ -97,6 +97,10 @@ int main(int argc, char *argv[]) { int v = VERBOSITY_NAME(FATAL) + (td::to_integer(arg)); SET_VERBOSITY_LEVEL(v); }); + p.add_option('V', "version", "shows adnl-pong build version", [&]() { + std::cout << "adnl-pong build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + }); p.add_option('h', "help", "prints_help", [&]() { char b[10240]; td::StringBuilder sb(td::MutableSlice{b, 10000}); diff --git a/adnl/adnl-proxy.cpp b/adnl/adnl-proxy.cpp index 93f33e40..e2d1129f 100644 --- a/adnl/adnl-proxy.cpp +++ b/adnl/adnl-proxy.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2017-2020 Telegram Systems LLP @@ -303,6 +303,10 @@ int main(int argc, char *argv[]) { int v = VERBOSITY_NAME(FATAL) + (td::to_integer(arg)); SET_VERBOSITY_LEVEL(v); }); + p.add_option('V', "version", "shows adnl-proxy build version", [&]() { + std::cout << "adnl-proxy build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + }); p.add_option('h', "help", "prints_help", [&]() { char b[10240]; td::StringBuilder sb(td::MutableSlice{b, 10000}); diff --git a/create-hardfork/create-hardfork.cpp b/create-hardfork/create-hardfork.cpp index 5c38ac02..e24c47af 100644 --- a/create-hardfork/create-hardfork.cpp +++ b/create-hardfork/create-hardfork.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2017-2020 Telegram Systems LLP @@ -263,6 +263,10 @@ int main(int argc, char *argv[]) { std::cout << sb.as_cslice().c_str(); std::exit(2); }); + p.add_option('V', "version", "shows create-hardfork build version", [&]() { + std::cout << "create-hardfork build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + }); p.add_option('D', "db", "root for dbs", [&](td::Slice fname) { td::actor::send_closure(x, &HardforkCreator::set_db_root, fname.str()); }); p.add_option('m', "ext-message", "binary file with serialized inbound external message", diff --git a/crypto/block/create-state.cpp b/crypto/block/create-state.cpp index 15c3e800..aee67600 100644 --- a/crypto/block/create-state.cpp +++ b/crypto/block/create-state.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2017-2020 Telegram Systems LLP @@ -804,7 +804,8 @@ void usage(const char* progname) { "\t-I\tSets colon-separated library source include path. If not indicated, " "$FIFTPATH is used instead.\n" "\t-L\tPre-loads a library source file\n" - "\t-v\tSet verbosity level\n"; + "\t-v\tSet verbosity level\n" + "\t-V\tShow create-state build version\n"; std::exit(2); } @@ -842,7 +843,7 @@ int main(int argc, char* const argv[]) { int i; int new_verbosity_level = VERBOSITY_NAME(INFO); - while (!script_mode && (i = getopt(argc, argv, "hinsI:L:v:")) != -1) { + while (!script_mode && (i = getopt(argc, argv, "hinsI:L:v:V")) != -1) { switch (i) { case 'i': interactive = true; @@ -864,6 +865,10 @@ int main(int argc, char* const argv[]) { case 'v': new_verbosity_level = VERBOSITY_NAME(FATAL) + (verbosity = td::to_integer(td::Slice(optarg))); break; + case 'V': + std::cout << "create-state build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + break; case 'h': default: usage(argv[0]); diff --git a/crypto/block/dump-block.cpp b/crypto/block/dump-block.cpp index 32b28b91..4a17c129 100644 --- a/crypto/block/dump-block.cpp +++ b/crypto/block/dump-block.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2017-2020 Telegram Systems LLP @@ -159,7 +159,7 @@ void test1() { std::cout << " cb = " << cb.finalize() << std::endl; } } - /* + /* { vm::CellBuilder cb; td::BitArray<256> hash; @@ -246,7 +246,8 @@ td::Status test_vset() { void usage() { std::cout << "usage: dump-block [-t][-S][]\n\tor dump-block -h\n\tDumps specified blockchain " "block or state " - "from , or runs some tests\n\t-S\tDump a blockchain state instead of a block\n"; + "from , or runs some tests\n\t-S\tDump a blockchain state instead of a block\n" + "\t-V\tShow fift build version\n"; std::exit(2); } @@ -259,7 +260,7 @@ int main(int argc, char* const argv[]) { bool store_loaded = false; int dump = 3; auto zerostate = std::make_unique(); - while ((i = getopt(argc, argv, "CSt:hqv:")) != -1) { + while ((i = getopt(argc, argv, "CSt:hqv:V")) != -1) { switch (i) { case 'C': type = &block::gen::t_VmCont; @@ -280,6 +281,10 @@ int main(int argc, char* const argv[]) { store_loaded = true; dump = 0; break; + case 'V': + std::cout << "dump-block build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + break; case 'h': usage(); std::exit(2); diff --git a/crypto/fift/fift-main.cpp b/crypto/fift/fift-main.cpp index 077cdecc..6952b4b7 100644 --- a/crypto/fift/fift-main.cpp +++ b/crypto/fift/fift-main.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2017-2020 Telegram Systems LLP @@ -65,7 +65,8 @@ void usage(const char* progname) { "\t-L\tPre-loads a library source file\n" "\t-d\tUse a ton database\n" "\t-s\tScript mode: use first argument as a fift source file and import remaining arguments as $n)\n" - "\t-v\tSet verbosity level\n"; + "\t-v\tSet verbosity level\n" + "\t-V\tShow fift build version\n"; std::exit(2); } @@ -92,7 +93,7 @@ int main(int argc, char* const argv[]) { int i; int new_verbosity_level = VERBOSITY_NAME(INFO); - while (!script_mode && (i = getopt(argc, argv, "hinI:L:d:sv:")) != -1) { + while (!script_mode && (i = getopt(argc, argv, "hinI:L:d:sv:V")) != -1) { switch (i) { case 'i': interactive = true; @@ -116,6 +117,11 @@ int main(int argc, char* const argv[]) { case 'v': new_verbosity_level = VERBOSITY_NAME(FATAL) + td::to_integer(td::Slice(optarg)); break; + case 'V': + std::cout << "Fift build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + break; + case 'h': default: usage(argv[0]); diff --git a/crypto/func/func.cpp b/crypto/func/func.cpp index d3eaf160..6abd8755 100644 --- a/crypto/func/func.cpp +++ b/crypto/func/func.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2017-2020 Telegram Systems LLP @@ -40,9 +40,9 @@ std::ostream* outs = &std::cout; std::string generated_from, boc_output_filename; /* - * + * * OUTPUT CODE GENERATOR - * + * */ void generate_output_func(SymDef* func_sym) { @@ -171,7 +171,8 @@ void usage(const char* progname) { "-S\tInclude stack layout comments in the output code\n" "-R\tInclude operation rewrite comments in the output code\n" "-W\tInclude Fift code to serialize and save generated code into specified BoC file. Enables " - "-A and -P.\n"; + "-A and -P.\n" + "\t-V\tShow func build version\n"; std::exit(2); } @@ -180,7 +181,7 @@ std::string output_filename; int main(int argc, char* const argv[]) { int i; bool interactive = false; - while ((i = getopt(argc, argv, "Ahi:Io:O:PRSvW:")) != -1) { + while ((i = getopt(argc, argv, "Ahi:Io:O:PRSvW:V")) != -1) { switch (i) { case 'A': funC::asm_preamble = true; @@ -213,6 +214,10 @@ int main(int argc, char* const argv[]) { funC::boc_output_filename = optarg; funC::asm_preamble = funC::program_envelope = true; break; + case 'V': + std::cout << "Func build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + break; case 'h': default: usage(argv[0]); diff --git a/dht-server/dht-server.cpp b/dht-server/dht-server.cpp index 8048a457..827ddff5 100644 --- a/dht-server/dht-server.cpp +++ b/dht-server/dht-server.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2017-2020 Telegram Systems LLP @@ -1182,6 +1182,10 @@ int main(int argc, char *argv[]) { int v = VERBOSITY_NAME(FATAL) + (td::to_integer(arg)); SET_VERBOSITY_LEVEL(v); }); + p.add_option('V', "version", "shows dht-server build version", [&]() { + std::cout << "dht-server build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + }); p.add_option('h', "help", "prints_help", [&]() { char b[10240]; td::StringBuilder sb(td::MutableSlice{b, 10000}); diff --git a/http/http-proxy.cpp b/http/http-proxy.cpp index 4470e55c..6b2f24eb 100644 --- a/http/http-proxy.cpp +++ b/http/http-proxy.cpp @@ -264,6 +264,10 @@ int main(int argc, char *argv[]) { int v = VERBOSITY_NAME(FATAL) + (td::to_integer(arg)); SET_VERBOSITY_LEVEL(v); }); + p.add_option('V', "version", "shows http-proxy build version", [&]() { + std::cout << "http-proxy build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + }); p.add_option('h', "help", "prints_help", [&]() { char b[10240]; td::StringBuilder sb(td::MutableSlice{b, 10000}); diff --git a/lite-client/lite-client.cpp b/lite-client/lite-client.cpp index f22bb0b5..592c34cc 100644 --- a/lite-client/lite-client.cpp +++ b/lite-client/lite-client.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2017-2020 Telegram Systems LLP @@ -4200,6 +4200,10 @@ int main(int argc, char* argv[]) { SET_VERBOSITY_LEVEL(VERBOSITY_NAME(FATAL) + verbosity); return (verbosity >= 0 && verbosity <= 9) ? td::Status::OK() : td::Status::Error("verbosity must be 0..9"); }); + p.add_option('V', "version", "shows lite-client build version", [&]() { + std::cout << "lite-client build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + }); p.add_option('i', "idx", "set liteserver idx", [&](td::Slice arg) { auto idx = td::to_integer(arg); td::actor::send_closure(x, &TestNode::set_liteserver_idx, idx); diff --git a/rldp-http-proxy/rldp-http-proxy.cpp b/rldp-http-proxy/rldp-http-proxy.cpp index b8258be3..010de93b 100644 --- a/rldp-http-proxy/rldp-http-proxy.cpp +++ b/rldp-http-proxy/rldp-http-proxy.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2019-2020 Telegram Systems LLP @@ -1133,6 +1133,10 @@ int main(int argc, char *argv[]) { int v = VERBOSITY_NAME(FATAL) + (td::to_integer(arg)); SET_VERBOSITY_LEVEL(v); }); + p.add_option('V', "version", "shows rldp-http-proxy build version", [&]() { + std::cout << "rldp-http-proxy build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + }); p.add_option('h', "help", "prints a help message", [&]() { char b[10240]; td::StringBuilder sb(td::MutableSlice{b, 10000}); diff --git a/tonlib/tonlib/tonlib-cli.cpp b/tonlib/tonlib/tonlib-cli.cpp index 2c1b5567..f39f1afc 100644 --- a/tonlib/tonlib/tonlib-cli.cpp +++ b/tonlib/tonlib/tonlib-cli.cpp @@ -2308,6 +2308,10 @@ int main(int argc, char* argv[]) { SET_VERBOSITY_LEVEL(VERBOSITY_NAME(FATAL) + verbosity); return (verbosity >= 0 && verbosity <= 20) ? td::Status::OK() : td::Status::Error("verbosity must be 0..20"); }); + p.add_option('V', "version", "show tonlib-cli build version", [&]() { + std::cout << "Fift build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + }); p.add_checked_option('C', "config-force", "set lite server config, drop config related blockchain cache", [&](td::Slice arg) { TRY_RESULT(data, td::read_file_str(arg.str())); diff --git a/utils/generate-random-id.cpp b/utils/generate-random-id.cpp index 75ff8725..af0cb3e0 100644 --- a/utils/generate-random-id.cpp +++ b/utils/generate-random-id.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2017-2020 Telegram Systems LLP @@ -59,6 +59,10 @@ int main(int argc, char *argv[]) { std::cout << sb.as_cslice().c_str(); std::exit(2); }); + p.add_option('V', "version", "shows generate-random-id build version", [&]() { + std::cout << "generate-random-id build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + }); p.add_option('n', "name", "path to save private keys to", [&](td::Slice arg) { name = arg.str(); }); p.add_checked_option('k', "key", "path to private key to import", [&](td::Slice key) { if (!pk.empty()) { diff --git a/utils/json2tlo.cpp b/utils/json2tlo.cpp index 7666de9e..c1767454 100644 --- a/utils/json2tlo.cpp +++ b/utils/json2tlo.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2017-2020 Telegram Systems LLP @@ -51,6 +51,10 @@ int main(int argc, char *argv[]) { p.add_option('i', "in", "input", [&](td::Slice key) { in_f = key.str(); }); p.add_option('o', "out", "output", [&](td::Slice key) { out_f = key.str(); }); p.add_option('r', "reverse", "read tlo, print json", [&]() { reverse_ = !reverse_; }); + p.add_option('V', "version", "shows json2tlo build version", [&]() { + std::cout << "json2tlo build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + }); p.add_option('h', "help", "prints_help", [&]() { char b[10240]; td::StringBuilder sb(td::MutableSlice{b, 10000}); diff --git a/validator-engine-console/validator-engine-console.cpp b/validator-engine-console/validator-engine-console.cpp index 500b6902..7f881560 100644 --- a/validator-engine-console/validator-engine-console.cpp +++ b/validator-engine-console/validator-engine-console.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2017-2020 Telegram Systems LLP @@ -256,6 +256,10 @@ int main(int argc, char* argv[]) { std::cout << sb.as_cslice().c_str(); std::exit(2); }); + p.add_option('V', "version", "shows validator-engine-console build version", [&]() { + std::cout << "validator-engine-console build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + }); p.add_checked_option('a', "address", "server address", [&](td::Slice arg) { td::IPAddress addr; TRY_STATUS(addr.init_host_port(arg.str())); diff --git a/validator-engine/validator-engine.cpp b/validator-engine/validator-engine.cpp index 83f2a1db..fa921db1 100644 --- a/validator-engine/validator-engine.cpp +++ b/validator-engine/validator-engine.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of TON Blockchain source code. TON Blockchain is free software; you can redistribute it and/or @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with TON Blockchain. If not, see . - In addition, as a special exception, the copyright holders give permission - to link the code of portions of this program with the OpenSSL library. - You must obey the GNU General Public License in all respects for all - of the code used other than OpenSSL. If you modify file(s) with this - exception, you may extend this exception to your version of the file(s), - but you are not obligated to do so. If you do not wish to do so, delete this - exception statement from your version. If you delete this exception statement + In addition, as a special exception, the copyright holders give permission + to link the code of portions of this program with the OpenSSL library. + You must obey the GNU General Public License in all respects for all + of the code used other than OpenSSL. If you modify file(s) with this + exception, you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Copyright 2017-2020 Telegram Systems LLP @@ -3286,6 +3286,10 @@ int main(int argc, char *argv[]) { int v = VERBOSITY_NAME(FATAL) + (td::to_integer(arg)); SET_VERBOSITY_LEVEL(v); }); + p.add_option('V', "version", "shows validator-engine build version", [&]() { + std::cout << "validator-engine build version: [" << BUILD_VERSION << "]\n"; + std::exit(0); + }); p.add_option('h', "help", "prints_help", [&]() { char b[10240]; td::StringBuilder sb(td::MutableSlice{b, 10000});