mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 05:05:00 -07:00
feat: report "build" in vim.version() #23925
Problem: Nvim version string typically has a "build" component but vim.version() doesn't report it. Solution: Add the "build" field to vim.version(). Closes #23863
This commit is contained in:
parent
385a1facf2
commit
199a990c9e
@ -14,6 +14,9 @@ if(RES)
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Extract build info: "v0.9.0-145-g0f9113907" => "g0f9113907"
|
||||||
|
string(REGEX REPLACE ".*\\-" "" NVIM_VERSION_BUILD "${GIT_TAG}")
|
||||||
|
|
||||||
# `git describe` annotates the most recent tagged release; for pre-release
|
# `git describe` annotates the most recent tagged release; for pre-release
|
||||||
# builds we append that to the dev version.
|
# builds we append that to the dev version.
|
||||||
if(NVIM_VERSION_PRERELEASE)
|
if(NVIM_VERSION_PRERELEASE)
|
||||||
@ -24,7 +27,7 @@ if(NVIM_VERSION_PRERELEASE)
|
|||||||
set(NVIM_VERSION "${NVIM_VERSION}-${NVIM_VERSION_GIT}")
|
set(NVIM_VERSION "${NVIM_VERSION}-${NVIM_VERSION_GIT}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(NVIM_VERSION_STRING "#define NVIM_VERSION_MEDIUM \"${NVIM_VERSION}\"\n")
|
set(NVIM_VERSION_STRING "#define NVIM_VERSION_MEDIUM \"${NVIM_VERSION}\"\n#define NVIM_VERSION_BUILD \"${NVIM_VERSION_BUILD}\"\n")
|
||||||
|
|
||||||
string(SHA1 CURRENT_VERSION_HASH "${NVIM_VERSION_STRING}")
|
string(SHA1 CURRENT_VERSION_HASH "${NVIM_VERSION_STRING}")
|
||||||
if(EXISTS ${OUTPUT})
|
if(EXISTS ${OUTPUT})
|
||||||
|
@ -2560,6 +2560,11 @@ Dictionary version_dict(void)
|
|||||||
PUT(d, "major", INTEGER_OBJ(NVIM_VERSION_MAJOR));
|
PUT(d, "major", INTEGER_OBJ(NVIM_VERSION_MAJOR));
|
||||||
PUT(d, "minor", INTEGER_OBJ(NVIM_VERSION_MINOR));
|
PUT(d, "minor", INTEGER_OBJ(NVIM_VERSION_MINOR));
|
||||||
PUT(d, "patch", INTEGER_OBJ(NVIM_VERSION_PATCH));
|
PUT(d, "patch", INTEGER_OBJ(NVIM_VERSION_PATCH));
|
||||||
|
#ifndef NVIM_VERSION_BUILD
|
||||||
|
PUT(d, "build", NIL);
|
||||||
|
#else
|
||||||
|
PUT(d, "build", CSTR_AS_OBJ(NVIM_VERSION_BUILD));
|
||||||
|
#endif
|
||||||
PUT(d, "prerelease", BOOLEAN_OBJ(NVIM_VERSION_PRERELEASE[0] != '\0'));
|
PUT(d, "prerelease", BOOLEAN_OBJ(NVIM_VERSION_PRERELEASE[0] != '\0'));
|
||||||
PUT(d, "api_level", INTEGER_OBJ(NVIM_API_LEVEL));
|
PUT(d, "api_level", INTEGER_OBJ(NVIM_API_LEVEL));
|
||||||
PUT(d, "api_compatible", INTEGER_OBJ(NVIM_API_LEVEL_COMPAT));
|
PUT(d, "api_compatible", INTEGER_OBJ(NVIM_API_LEVEL_COMPAT));
|
||||||
|
@ -34,6 +34,7 @@ describe("api_info()['version']", function()
|
|||||||
local minor = version['minor']
|
local minor = version['minor']
|
||||||
local patch = version['patch']
|
local patch = version['patch']
|
||||||
local prerelease = version['prerelease']
|
local prerelease = version['prerelease']
|
||||||
|
local build = version['build']
|
||||||
eq("number", type(major))
|
eq("number", type(major))
|
||||||
eq("number", type(minor))
|
eq("number", type(minor))
|
||||||
eq("number", type(patch))
|
eq("number", type(patch))
|
||||||
@ -42,6 +43,7 @@ describe("api_info()['version']", function()
|
|||||||
eq(0, funcs.has("nvim-"..major.."."..minor.."."..(patch + 1)))
|
eq(0, funcs.has("nvim-"..major.."."..minor.."."..(patch + 1)))
|
||||||
eq(0, funcs.has("nvim-"..major.."."..(minor + 1).."."..patch))
|
eq(0, funcs.has("nvim-"..major.."."..(minor + 1).."."..patch))
|
||||||
eq(0, funcs.has("nvim-"..(major + 1).."."..minor.."."..patch))
|
eq(0, funcs.has("nvim-"..(major + 1).."."..minor.."."..patch))
|
||||||
|
assert(build == nil or type(build) == 'string')
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user