aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2017-03-15 17:46:07 +0100
committerGitHub <noreply@github.com>2017-03-15 17:46:07 +0100
commitf4b8dbeeb21ca65c5cd19fa361c5588349c0a1e0 (patch)
tree183cfb73ac950194b70c37a1b89aeb57028cec6d /scripts
parentec4e84210b87965e7110b061a321c7ec8a359d47 (diff)
parent7d28489a338e7112c0c7dc5e5a131ba8dcd1b3d2 (diff)
downloadrneovim-f4b8dbeeb21ca65c5cd19fa361c5588349c0a1e0.tar.gz
rneovim-f4b8dbeeb21ca65c5cd19fa361c5588349c0a1e0.tar.bz2
rneovim-f4b8dbeeb21ca65c5cd19fa361c5588349c0a1e0.zip
Merge pull request #5540 from bfredl/api_since
allow specify api since field and more api compatibility checks
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gendispatch.lua13
-rwxr-xr-xscripts/release.sh9
2 files changed, 17 insertions, 5 deletions
diff --git a/scripts/gendispatch.lua b/scripts/gendispatch.lua
index 397ccc9aaf..45a4f4a4de 100644
--- a/scripts/gendispatch.lua
+++ b/scripts/gendispatch.lua
@@ -9,7 +9,8 @@ C, Ct, Cc, Cg = lpeg.C, lpeg.Ct, lpeg.Cc, lpeg.Cg
any = P(1) -- (consume one character)
letter = R('az', 'AZ') + S('_$')
-alpha = letter + R('09')
+num = R('09')
+alpha = letter + num
nl = P('\r\n') + P('\n')
not_nl = any - nl
ws = S(' \t') + nl
@@ -35,6 +36,7 @@ c_proto = Ct(
Cg(c_type, 'return_type') * Cg(c_id, 'name') *
fill * P('(') * fill * Cg(c_params, 'parameters') * fill * P(')') *
Cg(Cc(false), 'async') *
+ (fill * Cg((P('FUNC_API_SINCE(') * C(num ^ 1)) * P(')'), 'since') ^ -1) *
(fill * Cg((P('FUNC_API_ASYNC') * Cc(true)), 'async') ^ -1) *
(fill * Cg((P('FUNC_API_NOEXPORT') * Cc(true)), 'noexport') ^ -1) *
(fill * Cg((P('FUNC_API_NOEVAL') * Cc(true)), 'noeval') ^ -1) *
@@ -52,6 +54,7 @@ package.path = nvimsrcdir .. '/?.lua;' .. package.path
-- names of all headers relative to the source root (for inclusion in the
-- generated file)
headers = {}
+
-- output h file with generated dispatch functions
dispatch_outputf = arg[#arg-2]
-- output h file with packed metadata
@@ -114,9 +117,11 @@ local deprecated_aliases = require("api.dispatch_deprecated")
for i,f in ipairs(shallowcopy(functions)) do
local ismethod = false
if startswith(f.name, "nvim_") then
- -- TODO(bfredl) after 0.1.6 allow method definitions
- -- to specify the since and deprecated_since field
- f.since = 1
+ if f.since == nil then
+ print("Function "..f.name.." lacks since field.\n")
+ os.exit(1)
+ end
+ f.since = tonumber(f.since)
if startswith(f.name, "nvim_buf_") then
ismethod = true
elseif startswith(f.name, "nvim_win_") then
diff --git a/scripts/release.sh b/scripts/release.sh
index 93f9fa3d35..dac5e9b177 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -31,6 +31,8 @@ __VERSION_MINOR=$(grep 'set(NVIM_VERSION_MINOR' CMakeLists.txt\
__VERSION_PATCH=$(grep 'set(NVIM_VERSION_PATCH' CMakeLists.txt\
|$__sed 's/.*NVIM_VERSION_PATCH ([[:digit:]]).*/\1/')
__VERSION="${__VERSION_MAJOR}.${__VERSION_MINOR}.${__VERSION_PATCH}"
+__API_LEVEL=$(grep 'set(NVIM_API_LEVEL ' CMakeLists.txt\
+ |$__sed 's/.*NVIM_API_LEVEL ([[:digit:]]).*/\1/')
{ [ -z "$__VERSION_MAJOR" ] || [ -z "$__VERSION_MINOR" ] || [ -z "$__VERSION_PATCH" ]; } \
&& { echo "ERROR: version parse failed: '${__VERSION}'"; exit 1; }
__RELEASE_MSG="NVIM v${__VERSION}
@@ -47,7 +49,12 @@ __BUMP_MSG="version bump"
echo "Most recent tag: ${__LAST_TAG}"
echo "Release version: ${__VERSION}"
$__sed -i.bk 's/(NVIM_VERSION_PRERELEASE) "-dev"/\1 ""/' CMakeLists.txt
-$__sed -i.bk 's/(NVIM_API_PRERELEASE) true/\1 false/' CMakeLists.txt
+if grep '(NVIM_API_PRERELEASE true)' CMakeLists.txt > /dev/null; then
+ $__sed -i.bk 's/(NVIM_API_PRERELEASE) true/\1 false/' CMakeLists.txt
+ cp build/funcs_data.mpack test/functional/fixtures/api_level_$__API_LEVEL.mpack
+ git add test/functional/fixtures/api_level_$__API_LEVEL.mpack
+fi
+
echo "Building changelog since ${__LAST_TAG}..."
__CHANGELOG="$(./scripts/git-log-pretty-since.sh "$__LAST_TAG" 'vim-patch:\S')"