mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 05:05:00 -07:00
build: ensure version generation always succeeds (#19515)
Add --always flag to `git describe` so version generation succeeds if current directory is in a git repo. If not in git repo, fall back to a default version in the format vx.y.z-dev
This commit is contained in:
parent
4638fcf4fb
commit
2a1c65b330
@ -7,15 +7,11 @@ set(NVIM_VERSION_MEDIUM
|
|||||||
"v${NVIM_VERSION_MAJOR}.${NVIM_VERSION_MINOR}.${NVIM_VERSION_PATCH}${NVIM_VERSION_PRERELEASE}")
|
"v${NVIM_VERSION_MAJOR}.${NVIM_VERSION_MINOR}.${NVIM_VERSION_PATCH}${NVIM_VERSION_PRERELEASE}")
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND git describe --first-parent --dirty
|
COMMAND git describe --first-parent --dirty --always
|
||||||
OUTPUT_VARIABLE GIT_TAG
|
OUTPUT_VARIABLE GIT_TAG
|
||||||
ERROR_VARIABLE ERR
|
RESULT_VARIABLE RES)
|
||||||
RESULT_VARIABLE RES
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT RES EQUAL 0)
|
if(RES AND NOT RES EQUAL 0)
|
||||||
message(STATUS "Git tag extraction failed:\n" " ${GIT_TAG}${ERR}" )
|
|
||||||
# This will only be executed once since the file will get generated afterwards.
|
|
||||||
message(STATUS "Using NVIM_VERSION_MEDIUM: ${NVIM_VERSION_MEDIUM}")
|
message(STATUS "Using NVIM_VERSION_MEDIUM: ${NVIM_VERSION_MEDIUM}")
|
||||||
file(WRITE "${OUTPUT}" "${NVIM_VERSION_STRING}")
|
file(WRITE "${OUTPUT}" "${NVIM_VERSION_STRING}")
|
||||||
return()
|
return()
|
||||||
|
Loading…
Reference in New Issue
Block a user