Skip to content

Commit

Permalink
Confirm repo git info before compilation (#6247)
Browse files Browse the repository at this point in the history
close #5479
  • Loading branch information
solotzg authored Nov 4, 2022
1 parent 041ea1a commit 0ecaf19
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dbms/cmake/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@ set (TIFLASH_VERSION_REVISION 0)
set (TIFLASH_VERSION "${TIFLASH_VERSION_MAJOR}.${TIFLASH_VERSION_MINOR}.${TIFLASH_VERSION_REVISION}")

# Release version that follows PD/TiKV/TiDB convention.
# Variables bellow are important, use `COMMAND_ERROR_IS_FATAL ANY`(since cmake 3.19) to confirm that there is output.

execute_process(
COMMAND git describe --tags --dirty --always
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE TIFLASH_RELEASE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)

set (TIFLASH_EDITION $ENV{TIFLASH_EDITION})
Expand All @@ -69,19 +72,22 @@ execute_process(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE TIFLASH_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)

execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE TIFLASH_GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)

execute_process(
COMMAND date -u "+%Y-%m-%d %H:%M:%S"
OUTPUT_VARIABLE TIFLASH_UTC_BUILD_TIME
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)

set (TIFLASH_PROFILE ${CMAKE_BUILD_TYPE})

0 comments on commit 0ecaf19

Please sign in to comment.