1
0
Fork 0
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:
Alex Melman 2021-03-26 00:26:49 +02:00 committed by main
parent 41a3418b7b
commit bab4c1637e
40 changed files with 492 additions and 78 deletions

View file

@ -5,18 +5,18 @@ if (NOT OPENSSL_FOUND)
endif()
add_executable(generate-random-id generate-random-id.cpp )
target_link_libraries(generate-random-id tl_api ton_crypto keys adnl)
target_link_libraries(generate-random-id tl_api ton_crypto keys adnl git)
target_include_directories(generate-random-id PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/..)
add_executable(json2tlo json2tlo.cpp )
target_link_libraries(json2tlo tl_api ton_crypto keys )
target_link_libraries(json2tlo tl_api ton_crypto keys git)
target_include_directories(json2tlo PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/..)
add_executable(pack-viewer pack-viewer.cpp )
target_link_libraries(pack-viewer tl_api ton_crypto keys validator tddb )
target_link_libraries(pack-viewer tl_api ton_crypto keys validator tddb)
target_include_directories(pack-viewer PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/..)

View file

@ -39,6 +39,7 @@
#include "td/utils/filesystem.h"
#include "keys/encryptor.h"
#include "keys/keys.hpp"
#include "git.h"
int main(int argc, char *argv[]) {
ton::PrivateKey pk;
@ -59,8 +60,8 @@ 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";
p.add_option('V', "version", "shows generate-random-id build information", [&]() {
std::cout << "generate-random-id build information: [ Commit: " << GitMetadata::CommitSHA1() << ", Date: " << GitMetadata::CommitDate() << "]\n";
std::exit(0);
});
p.add_option('n', "name", "path to save private keys to", [&](td::Slice arg) { name = arg.str(); });

View file

@ -39,6 +39,7 @@
#include "tl/tl_json.h"
#include "auto/tl/ton_api.h"
#include "auto/tl/ton_api_json.h"
#include "git.h"
int main(int argc, char *argv[]) {
std::string in_f;
@ -51,8 +52,8 @@ 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";
p.add_option('V', "version", "shows json2tlo build information", [&]() {
std::cout << "json2tlo build information: [ Commit: " << GitMetadata::CommitSHA1() << ", Date: " << GitMetadata::CommitDate() << "]\n";
std::exit(0);
});
p.add_option('h', "help", "prints_help", [&]() {