mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
refactor(build): derocksify luacheck
This commit is contained in:
parent
131a1ee82d
commit
6985e12cae
@ -220,13 +220,13 @@ find_program(STYLUA_PRG stylua ${LINT_REQUIRED})
|
||||
|
||||
add_glob_target(
|
||||
TARGET lintlua-luacheck
|
||||
COMMAND ${DEPS_BIN_DIR}/luacheck
|
||||
FLAGS -q
|
||||
COMMAND $<TARGET_FILE:nvim>
|
||||
FLAGS -ll ${PROJECT_SOURCE_DIR}/test/lua_runner.lua ${CMAKE_BINARY_DIR}/usr luacheck -q
|
||||
GLOB_DIRS runtime/ scripts/ src/ test/
|
||||
GLOB_PAT *.lua
|
||||
EXCLUDE runtime/lua/vim/_meta/.*
|
||||
TOUCH_STRATEGY SINGLE)
|
||||
add_dependencies(lintlua-luacheck luacheck)
|
||||
add_dependencies(lintlua-luacheck lua-dev-deps)
|
||||
|
||||
add_glob_target(
|
||||
TARGET lintlua-stylua
|
||||
@ -297,14 +297,14 @@ ExternalProject_Add(uncrustify
|
||||
|
||||
include(BuildLuarocks)
|
||||
|
||||
ExternalProject_Add(busted
|
||||
URL https://github.com/neovim/deps/raw/41d2f1b92aef964c8cb86985768702571e190e96/opt/busted-2.1.1.tar.gz
|
||||
URL_HASH SHA256=9b23efce883ad25a3fe140598a32ab89ecc73f4c3d998cb937293d88e5b4c645
|
||||
ExternalProject_Add(lua-dev-deps
|
||||
URL https://github.com/neovim/deps/raw/5a1f71cceb24990a0b15fd9a472a5f549f019248/opt/lua-dev-deps.tar.gz
|
||||
URL_HASH SHA256=27db2495f5eddc7fc191701ec9b291486853530c6125609d3197d03481e8d5a2
|
||||
DOWNLOAD_NO_PROGRESS TRUE
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/busted
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua-dev-deps
|
||||
SOURCE_DIR ${DEPS_SHARE_DIR}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
EXCLUDE_FROM_ALL TRUE)
|
||||
add_dependencies(test_deps busted)
|
||||
add_dependencies(test_deps lua-dev-deps)
|
||||
|
@ -63,12 +63,11 @@ if(NOT DEFINED ENV{TEST_TIMEOUT} OR "$ENV{TEST_TIMEOUT}" STREQUAL "")
|
||||
endif()
|
||||
|
||||
set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua.
|
||||
set(ENV{DEPS_INSTALL_DIR} ${DEPS_INSTALL_DIR}) # used by test/busted_runner.lua
|
||||
|
||||
execute_process(
|
||||
# Note: because of "-ll" (low-level interpreter mode), some modules like
|
||||
# _editor.lua are not loaded.
|
||||
COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/busted_runner.lua -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE}
|
||||
COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/lua_runner.lua ${DEPS_INSTALL_DIR} busted -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE}
|
||||
--lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
|
||||
--lpath=${BUILD_DIR}/?.lua
|
||||
--lpath=${WORKING_DIR}/runtime/lua/?.lua
|
||||
|
@ -1,11 +1,16 @@
|
||||
local platform = vim.uv.os_uname()
|
||||
local deps_install_dir = os.getenv 'DEPS_INSTALL_DIR'
|
||||
local deps_install_dir = table.remove(_G.arg, 1)
|
||||
local subcommand = table.remove(_G.arg, 1)
|
||||
local suffix = (platform and platform.sysname:lower():find'windows') and '.dll' or '.so'
|
||||
package.path = deps_install_dir.."/share/lua/5.1/?.lua;"..deps_install_dir.."/share/lua/5.1/?/init.lua;"..package.path
|
||||
package.cpath = deps_install_dir.."/lib/lua/5.1/?"..suffix..";"..package.cpath;
|
||||
|
||||
local uv = vim.uv
|
||||
|
||||
-- we use busted and luacheck and their lua dependencies
|
||||
-- But installing their binary dependencies with luarocks is very
|
||||
-- slow, replace them with vim.uv wrappers
|
||||
|
||||
local system = {}
|
||||
package.loaded['system.core'] = system
|
||||
function system.monotime()
|
||||
@ -26,13 +31,17 @@ function term.isatty(_)
|
||||
return uv.guess_handle(1) == 'tty'
|
||||
end
|
||||
|
||||
local lfs = {}
|
||||
local lfs = {_VERSION = 'fake'}
|
||||
package.loaded['lfs'] = lfs
|
||||
|
||||
function lfs.attributes(path, attr)
|
||||
local stat = uv.fs_stat(path)
|
||||
if attr == 'mode' then
|
||||
local stat = uv.fs_stat(path)
|
||||
return stat and stat.type or ''
|
||||
elseif attr == 'modification' then
|
||||
if not stat then return nil end
|
||||
local mtime = stat.mtime
|
||||
return mtime.sec + mtime.nsec*1e-9
|
||||
else
|
||||
error('not implemented')
|
||||
end
|
||||
@ -61,4 +70,14 @@ function lfs.dir(path)
|
||||
end
|
||||
end
|
||||
|
||||
require 'busted.runner'({ standalone = false })
|
||||
function lfs.mkdir(dir)
|
||||
return uv.fs_mkdir(dir, 493) -- octal 755
|
||||
end
|
||||
|
||||
if subcommand == "busted" then
|
||||
require 'busted.runner'({ standalone = false })
|
||||
elseif subcommand == "luacheck" then
|
||||
require 'luacheck.main'
|
||||
else
|
||||
error 'unknown subcommand'
|
||||
end
|
Loading…
Reference in New Issue
Block a user