From 702892270dec627acb3dd585495ee0950f690bde Mon Sep 17 00:00:00 2001 From: bfredl Date: Fri, 21 Apr 2023 16:46:35 +0200 Subject: [PATCH] refactor(build): move the last generator from scripts/ to src/nvim/generators This one generates a runtime/ file instead of a source file. But otherwise it works the same like all other generators. It has the same prerequisites (shared and mpack modules, etc), and, importantly, it uses results from the source generators. The odd location makes it easy to overlook when refactoring generators (like I did last time, lol) --- runtime/CMakeLists.txt | 5 ++--- .../nvim/generators/gen_vimvim.lua | 14 ++------------ 2 files changed, 4 insertions(+), 15 deletions(-) rename scripts/genvimvim.lua => src/nvim/generators/gen_vimvim.lua (91%) diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 5d69962aba..0077604141 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -1,4 +1,4 @@ -set(SYN_VIM_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/genvimvim.lua) +set(SYN_VIM_GENERATOR ${PROJECT_SOURCE_DIR}/src/nvim/generators/gen_vimvim.lua) set(GENERATED_RUNTIME_DIR ${PROJECT_BINARY_DIR}/runtime) set(GENERATED_SYN_VIM ${GENERATED_RUNTIME_DIR}/syntax/vim/generated.vim) set(GENERATED_HELP_TAGS ${GENERATED_RUNTIME_DIR}/doc/tags) @@ -13,8 +13,7 @@ get_directory_property(LUA_GEN DIRECTORY ${PROJECT_SOURCE_DIR}/src/nvim DEFINITI get_directory_property(LUA_GEN_DEPS DIRECTORY ${PROJECT_SOURCE_DIR}/src/nvim DEFINITION LUA_GEN_DEPS) add_custom_command(OUTPUT ${GENERATED_SYN_VIM} - COMMAND ${LUA_GEN} ${SYN_VIM_GENERATOR} - ${PROJECT_SOURCE_DIR}/src/nvim ${GENERATED_SYN_VIM} ${FUNCS_DATA} + COMMAND ${LUA_GEN} ${SYN_VIM_GENERATOR} ${GENERATED_SYN_VIM} ${FUNCS_DATA} DEPENDS ${LUA_GEN_DEPS} ${SYN_VIM_GENERATOR} diff --git a/scripts/genvimvim.lua b/src/nvim/generators/gen_vimvim.lua similarity index 91% rename from scripts/genvimvim.lua rename to src/nvim/generators/gen_vimvim.lua index 18279d160e..09a7cab0c6 100644 --- a/scripts/genvimvim.lua +++ b/src/nvim/generators/gen_vimvim.lua @@ -1,17 +1,7 @@ local mpack = vim.mpack -if arg[1] == '--help' then - print('Usage: lua genvimvim.lua src/nvim runtime/syntax/vim/generated.vim') - os.exit(0) -end - -local nvimsrcdir = arg[1] -local syntax_file = arg[2] -local funcs_file = arg[3] - -package.path = nvimsrcdir .. '/?.lua;' .. package.path - -_G.vim = loadfile(nvimsrcdir..'/../../runtime/lua/vim/shared.lua')() +local syntax_file = arg[1] +local funcs_file = arg[2] local lld = {} local syn_fd = io.open(syntax_file, 'w')