mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Automatically integrates git build information into executables.
Usage:
func.exe -V
adnl-pong -V
validator-engine -V
and so on.
Result will be shown in the following format:
Func build information: [ Commit: d8b751d7a5
, Date: 2021-02-27 14:34:41 +0200]
This commit is contained in:
parent
41a3418b7b
commit
bab4c1637e
40 changed files with 492 additions and 78 deletions
|
@ -284,7 +284,7 @@ target_link_libraries(fift-lib PUBLIC ton_crypto ton_db tdutils ton_block)
|
|||
set_target_properties(fift-lib PROPERTIES OUTPUT_NAME fift)
|
||||
|
||||
add_executable(fift fift/fift-main.cpp)
|
||||
target_link_libraries(fift PUBLIC fift-lib)
|
||||
target_link_libraries(fift PUBLIC fift-lib git)
|
||||
if (WINGETOPT_FOUND)
|
||||
target_link_libraries_system(fift wingetopt)
|
||||
endif()
|
||||
|
@ -295,7 +295,7 @@ target_link_libraries(src_parser PUBLIC ton_crypto)
|
|||
|
||||
add_executable(func func/func.cpp ${FUNC_LIB_SOURCE})
|
||||
target_include_directories(func PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||
target_link_libraries(func PUBLIC ton_crypto src_parser)
|
||||
target_link_libraries(func PUBLIC ton_crypto src_parser git)
|
||||
if (WINGETOPT_FOUND)
|
||||
target_link_libraries_system(func wingetopt)
|
||||
endif()
|
||||
|
@ -312,10 +312,11 @@ target_include_directories(pow-miner-lib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURREN
|
|||
target_link_libraries(pow-miner-lib PUBLIC ton_crypto ton_block)
|
||||
|
||||
add_executable(pow-miner util/pow-miner.cpp)
|
||||
target_link_libraries(pow-miner PRIVATE ton_crypto ton_block pow-miner-lib)
|
||||
target_link_libraries(pow-miner PRIVATE ton_crypto ton_block pow-miner-lib git)
|
||||
|
||||
if (WINGETOPT_FOUND)
|
||||
target_link_libraries_system(fift wingetopt)
|
||||
target_link_libraries_system(pow-miner wingetopt)
|
||||
endif()
|
||||
|
||||
add_library(ton_block ${BLOCK_SOURCE})
|
||||
|
@ -404,12 +405,12 @@ add_executable(create-state block/create-state.cpp)
|
|||
target_include_directories(create-state PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)
|
||||
if (INTERNAL_COMPILE)
|
||||
target_link_libraries(create-state PUBLIC ton_crypto fift-lib ton_block tonlib)
|
||||
target_link_libraries(create-state PUBLIC ton_crypto fift-lib ton_block tonlib git)
|
||||
else()
|
||||
if (TONLIB_COMPILE)
|
||||
target_link_libraries(create-state PUBLIC ton_crypto fift-lib ton_block tonlib)
|
||||
target_link_libraries(create-state PUBLIC ton_crypto fift-lib ton_block tonlib git)
|
||||
else()
|
||||
target_link_libraries(create-state PUBLIC ton_crypto fift-lib ton_block)
|
||||
target_link_libraries(create-state PUBLIC ton_crypto fift-lib ton_block git)
|
||||
endif()
|
||||
endif()
|
||||
if (WINGETOPT_FOUND)
|
||||
|
@ -419,7 +420,7 @@ endif()
|
|||
add_executable(dump-block block/dump-block.cpp)
|
||||
target_include_directories(dump-block PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)
|
||||
target_link_libraries(dump-block PUBLIC ton_crypto fift-lib ton_block)
|
||||
target_link_libraries(dump-block PUBLIC ton_crypto fift-lib ton_block git)
|
||||
if (WINGETOPT_FOUND)
|
||||
target_link_libraries_system(dump-block wingetopt)
|
||||
endif()
|
||||
|
@ -427,15 +428,16 @@ endif()
|
|||
add_executable(adjust-block block/adjust-block.cpp)
|
||||
target_include_directories(adjust-block PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)
|
||||
target_link_libraries(adjust-block PUBLIC ton_crypto fift-lib ton_block)
|
||||
target_link_libraries(adjust-block PUBLIC ton_crypto fift-lib ton_block git)
|
||||
if (WINGETOPT_FOUND)
|
||||
target_link_libraries_system(dump-block wingetopt)
|
||||
target_link_libraries_system(adjust-block wingetopt)
|
||||
endif()
|
||||
|
||||
add_executable(test-weight-distr block/test-weight-distr.cpp)
|
||||
target_include_directories(test-weight-distr PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)
|
||||
target_link_libraries(test-weight-distr PUBLIC ton_crypto fift-lib ton_block)
|
||||
target_link_libraries(test-weight-distr PUBLIC ton_crypto fift-lib ton_block git)
|
||||
if (WINGETOPT_FOUND)
|
||||
target_link_libraries_system(test-weight-distr wingetopt)
|
||||
endif()
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "vm/cp0.h"
|
||||
#include "td/utils/crypto.h"
|
||||
#include <getopt.h>
|
||||
#include "git.h"
|
||||
|
||||
using td::Ref;
|
||||
using namespace std::literals::string_literals;
|
||||
|
@ -144,7 +145,7 @@ int main(int argc, char* const argv[]) {
|
|||
int i, vseqno_incr = 1;
|
||||
int new_verbosity_level = VERBOSITY_NAME(INFO);
|
||||
std::string in_fname, out_fname;
|
||||
while ((i = getopt(argc, argv, "hi:v:")) != -1) {
|
||||
while ((i = getopt(argc, argv, "hi:v:V")) != -1) {
|
||||
switch (i) {
|
||||
case 'h':
|
||||
usage();
|
||||
|
@ -156,6 +157,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 << "adjust-block build information: [ Commit: " << GitMetadata::CommitSHA1() << ", Date: " << GitMetadata::CommitDate() << "]\n";
|
||||
std::exit(0);
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "block-parse.h"
|
||||
#include "block-auto.h"
|
||||
#include "mc-config.h"
|
||||
#include "git.h"
|
||||
|
||||
#if defined(_INTERNAL_COMPILE) || defined(_TONLIB_COMPILE)
|
||||
#define WITH_TONLIB
|
||||
|
@ -805,7 +806,7 @@ void usage(const char* progname) {
|
|||
"$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<version>\tShow create-state build version\n";
|
||||
"\t-V<version>\tShow create-state build information\n";
|
||||
std::exit(2);
|
||||
}
|
||||
|
||||
|
@ -865,8 +866,8 @@ 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";
|
||||
case 'V':
|
||||
std::cout << "create-state build information: [ Commit: " << GitMetadata::CommitSHA1() << ", Date: " << GitMetadata::CommitDate() << "]\n";
|
||||
std::exit(0);
|
||||
break;
|
||||
case 'h':
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "mc-config.h"
|
||||
#include "vm/cp0.h"
|
||||
#include <getopt.h>
|
||||
#include "git.h"
|
||||
|
||||
using td::Ref;
|
||||
using namespace std::literals::string_literals;
|
||||
|
@ -247,7 +248,7 @@ 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"
|
||||
"\t-V<version>\tShow fift build version\n";
|
||||
"\t-V<version>\tShow fift build information\n";
|
||||
std::exit(2);
|
||||
}
|
||||
|
||||
|
@ -282,7 +283,7 @@ int main(int argc, char* const argv[]) {
|
|||
dump = 0;
|
||||
break;
|
||||
case 'V':
|
||||
std::cout << "dump-block build version: [" << BUILD_VERSION << "]\n";
|
||||
std::cout << "dump-block build information: [ Commit: " << GitMetadata::CommitSHA1() << ", Date: " << GitMetadata::CommitDate() << "]\n";
|
||||
std::exit(0);
|
||||
break;
|
||||
case 'h':
|
||||
|
|
|
@ -53,6 +53,8 @@
|
|||
#include "td/utils/Parser.h"
|
||||
#include "td/utils/port/path.h"
|
||||
|
||||
#include "git.h"
|
||||
|
||||
void usage(const char* progname) {
|
||||
std::cerr << "A simple Fift interpreter. Type `bye` to quit, or `words` to get a list of all commands\n";
|
||||
std::cerr
|
||||
|
@ -66,7 +68,7 @@ void usage(const char* progname) {
|
|||
"\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<version>\tShow fift build version\n";
|
||||
"\t-V<version>\tShow fift build information\n";
|
||||
std::exit(2);
|
||||
}
|
||||
|
||||
|
@ -118,7 +120,7 @@ int main(int argc, char* const argv[]) {
|
|||
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::cout << "Fift build information: [ Commit: " << GitMetadata::CommitSHA1() << ", Date: " << GitMetadata::CommitDate() << "]\n";
|
||||
std::exit(0);
|
||||
break;
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "parser/symtable.h"
|
||||
#include <getopt.h>
|
||||
#include <fstream>
|
||||
#include "git.h"
|
||||
|
||||
namespace funC {
|
||||
|
||||
|
@ -172,7 +173,7 @@ void usage(const char* progname) {
|
|||
"-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"
|
||||
"\t-V<version>\tShow func build version\n";
|
||||
"\t-V<version>\tShow func build information\n";
|
||||
std::exit(2);
|
||||
}
|
||||
|
||||
|
@ -215,7 +216,7 @@ int main(int argc, char* const argv[]) {
|
|||
funC::asm_preamble = funC::program_envelope = true;
|
||||
break;
|
||||
case 'V':
|
||||
std::cout << "Func build version: [" << BUILD_VERSION << "]\n";
|
||||
std::cout << "Func build information: [ Commit: " << GitMetadata::CommitSHA1() << ", Date: " << GitMetadata::CommitDate() << "]\n";
|
||||
std::exit(0);
|
||||
break;
|
||||
case 'h':
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <thread>
|
||||
#include <cstdlib>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "git.h"
|
||||
#include "Miner.h"
|
||||
|
||||
const char* progname;
|
||||
|
@ -46,7 +46,7 @@ int usage() {
|
|||
std::cerr
|
||||
<< "usage: " << progname
|
||||
<< " [-v][-B][-w<threads>] [-t<timeout>] <my-address> <pow-seed> <pow-complexity> <iterations> [<miner-addr> "
|
||||
"<output-ext-msg-boc>]\n"
|
||||
"<output-ext-msg-boc>] [-V]\n"
|
||||
"Outputs a valid <rdata> value for proof-of-work testgiver after computing at most <iterations> hashes "
|
||||
"or terminates with non-zero exit code\n";
|
||||
std::exit(2);
|
||||
|
@ -156,7 +156,7 @@ int main(int argc, char* const argv[]) {
|
|||
progname = argv[0];
|
||||
int i, threads = 0;
|
||||
bool bounce = false, benchmark = false;
|
||||
while ((i = getopt(argc, argv, "bnvw:t:Bh")) != -1) {
|
||||
while ((i = getopt(argc, argv, "bnvw:t:Bh:V")) != -1) {
|
||||
switch (i) {
|
||||
case 'v':
|
||||
++verbosity;
|
||||
|
@ -180,6 +180,10 @@ int main(int argc, char* const argv[]) {
|
|||
case 'n':
|
||||
bounce = false;
|
||||
break;
|
||||
case 'V':
|
||||
std::cout << "pow-miner build information: [ Commit: " << GitMetadata::CommitSHA1() << ", Date: " << GitMetadata::CommitDate() << "]\n";
|
||||
std::exit(0);
|
||||
break;
|
||||
case 'h':
|
||||
return usage();
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue