1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-14 12:12:21 +00:00

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.
This commit is contained in:
Alex Melman 2021-02-27 14:34:41 +02:00
parent a002ab1bac
commit d8b751d7a5
17 changed files with 195 additions and 124 deletions

View file

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

View file

@ -97,6 +97,10 @@ int main(int argc, char *argv[]) {
int v = VERBOSITY_NAME(FATAL) + (td::to_integer<int>(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});

View file

@ -303,6 +303,10 @@ int main(int argc, char *argv[]) {
int v = VERBOSITY_NAME(FATAL) + (td::to_integer<int>(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});

View file

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

View file

@ -804,7 +804,8 @@ void usage(const char* progname) {
"\t-I<source-search-path>\tSets colon-separated library source include path. If not indicated, "
"$FIFTPATH is used instead.\n"
"\t-L<library-fif-file>\tPre-loads a library source file\n"
"\t-v<verbosity-level>\tSet verbosity level\n";
"\t-v<verbosity-level>\tSet verbosity level\n"
"\t-V<version>\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<int>(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]);

View file

@ -246,7 +246,8 @@ td::Status test_vset() {
void usage() {
std::cout << "usage: dump-block [-t<typename>][-S][<boc-file>]\n\tor dump-block -h\n\tDumps specified blockchain "
"block or state "
"from <boc-file>, or runs some tests\n\t-S\tDump a blockchain state instead of a block\n";
"from <boc-file>, or runs some tests\n\t-S\tDump a blockchain state instead of a block\n"
"\t-V<version>\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<block::ZerostateInfo>();
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);

View file

@ -65,7 +65,8 @@ void usage(const char* progname) {
"\t-L<library-fif-file>\tPre-loads a library source file\n"
"\t-d<ton-db-path>\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<verbosity-level>\tSet verbosity level\n";
"\t-v<verbosity-level>\tSet verbosity level\n"
"\t-V<version>\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<int>(td::Slice(optarg));
break;
case 'V':
std::cout << "Fift build version: [" << BUILD_VERSION << "]\n";
std::exit(0);
break;
case 'h':
default:
usage(argv[0]);

View file

@ -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<output-boc-file>\tInclude Fift code to serialize and save generated code into specified BoC file. Enables "
"-A and -P.\n";
"-A and -P.\n"
"\t-V<version>\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]);

View file

@ -1182,6 +1182,10 @@ int main(int argc, char *argv[]) {
int v = VERBOSITY_NAME(FATAL) + (td::to_integer<int>(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});

View file

@ -264,6 +264,10 @@ int main(int argc, char *argv[]) {
int v = VERBOSITY_NAME(FATAL) + (td::to_integer<int>(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});

View file

@ -4199,6 +4199,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<int>(arg);
td::actor::send_closure(x, &TestNode::set_liteserver_idx, idx);

View file

@ -1133,6 +1133,10 @@ int main(int argc, char *argv[]) {
int v = VERBOSITY_NAME(FATAL) + (td::to_integer<int>(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});

View file

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

View file

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

View file

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

View file

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

View file

@ -3286,6 +3286,10 @@ int main(int argc, char *argv[]) {
int v = VERBOSITY_NAME(FATAL) + (td::to_integer<int>(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});