feat add BUILD_NUMBER to version

This commit is contained in:
tqcq 2024-07-27 12:53:30 +08:00 committed by tqcq
parent 42b12a606a
commit f99ccf6baf
5 changed files with 13 additions and 7 deletions

View File

@ -3,10 +3,13 @@ cmake_minimum_required(VERSION 3.5)
set(tile_VERSION_MAJOR 0) set(tile_VERSION_MAJOR 0)
set(tile_VERSION_MINOR 1) set(tile_VERSION_MINOR 1)
set(tile_VERSION_PATCH 0) set(tile_VERSION_PATCH 0)
set(tile_VERSION_BUILD $ENV{BUILD_NUMBER})
if (NOT tile_VERSION_BUILD)
set(tile_VERSION_BUILD "0")
endif()
project( project(
tile tile
VERSION ${tile_VERSION_MAJOR}.${tile_VERSION_MINOR}.${tile_VERSION_PATCH} VERSION ${tile_VERSION_MAJOR}.${tile_VERSION_MINOR}.${tile_VERSION_PATCH}.${tile_VERSION_BUILD}
LANGUAGES C CXX) LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
@ -221,7 +224,8 @@ target_precompile_headers(tile PUBLIC json/nlohann/json.hpp)
# target_sources(tile PRIVATE ${TILE_SRCS}) # target_sources(tile PRIVATE ${TILE_SRCS})
target_include_directories( target_include_directories(
tile tile
PUBLIC "${CMAKE_CURRENT_BINARY_DIR}" PUBLIC
"${CMAKE_CURRENT_BINARY_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/third_party/fmt/include" "${CMAKE_CURRENT_SOURCE_DIR}/third_party/fmt/include"
"${CMAKE_CURRENT_BINARY_DIR}/third_party/glog" "${CMAKE_CURRENT_BINARY_DIR}/third_party/glog"
"${CMAKE_CURRENT_SOURCE_DIR}/third_party/glog/src" "${CMAKE_CURRENT_SOURCE_DIR}/third_party/glog/src"

2
Jenkinsfile vendored
View File

@ -1,7 +1,7 @@
pipeline { pipeline {
agent { agent {
docker { docker {
image 'tqcq/cross' image 'art.uocat.com/tqcq/cross:v1.0.1'
} }
} }

View File

@ -20,6 +20,7 @@
#define TILE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@" #define TILE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@"
#define TILE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@" #define TILE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
#define TILE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@" #define TILE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@"
#define TILE_VERSION "@PROJECT_VERSOIN@"
// clang-format on // clang-format on

View File

@ -139,7 +139,7 @@ TEST(Endpoint, ResolveDomainName) {
const std::string test_domain = "www.baidu.com"; const std::string test_domain = "www.baidu.com";
auto eps = ResolveDomain(test_domain, 80); auto eps = ResolveDomain(test_domain, 80);
ASSERT_TRUE(eps); ASSERT_TRUE(eps) << eps.error();
for (auto &ep : *eps) { for (auto &ep : *eps) {
std::cout << Format("Get IP From {}: {}", test_domain, ep.ToString()) std::cout << Format("Get IP From {}: {}", test_domain, ep.ToString())
<< std::endl; << std::endl;

View File

@ -1,6 +1,7 @@
#include "init.h" #include "init.h"
#include "tile/base/chrono.h" #include "tile/base/chrono.h"
#include "tile/base/config.h"
#include "tile/base/internal/background_task_host.h" #include "tile/base/internal/background_task_host.h"
#include "tile/base/internal/time_keeper.h" #include "tile/base/internal/time_keeper.h"
#include "tile/base/internal/utility.h" #include "tile/base/internal/utility.h"
@ -54,14 +55,14 @@ int Start(int argc, char **argv, std::function<int(int, char **)> cb,
} }
// Init gflags // Init gflags
gflags::SetVersionString("0.1.0"); gflags::SetVersionString(TILE_VERSION);
gflags::ParseCommandLineFlags(&argc, &argv, true); gflags::ParseCommandLineFlags(&argc, &argv, true);
detail::ApplyFlagOverrider(); detail::ApplyFlagOverrider();
// Init Glog // Init Glog
google::InitGoogleLogging(argv[0]); google::InitGoogleLogging(argv[0]);
TILE_LOG_INFO("Tile started."); TILE_LOG_INFO("Tile started. version: {}", TILE_VERSION);
TILE_PCHECK(signal(SIGPIPE, SIG_IGN) != SIG_ERR); TILE_PCHECK(signal(SIGPIPE, SIG_IGN) != SIG_ERR);