build(lint): fix luacheck not found #18940

Problem:
Since 6d57bb89c1 #18543, luacheck is not found on some systems when
running the "lintlua" target.

Solution:
- Move the find_program() to the top-level CMakeLists.txt
- Define a def_cmd_target() function with fewer assumptions than the old
  lint() function.
- Move "lintuncrustify" to src/nvim/CMakeLists.txt so it can reuse the
  $LINT_NVIM_SOURCES already defined there.
- Make the lint targets _fatal_ by default. There is little reason for
  the "lint" umbrella target defined in Makefile to exist if it's going
  to ignore the absence of the actual linters.
- For now, keep the uncrustify call in a separate cmake script so that
  it can be silenced (too noisy).
This commit is contained in:
Justin M. Keyes
2022-06-13 00:08:01 +02:00
committed by GitHub
parent 429c40cce3
commit f90174c98c
5 changed files with 72 additions and 43 deletions

View File

@@ -1,5 +1,7 @@
option(USE_GCOV "Enable gcov support" OFF)
include(DefCmdTarget)
if(USE_GCOV)
if(CLANG_TSAN)
# GCOV and TSAN results in false data race reports
@@ -802,12 +804,22 @@ foreach(sfile ${LINT_NVIM_SOURCES})
endforeach()
add_custom_target(lintc DEPENDS ${LINT_TARGETS})
def_cmd_target(lintuncrustify ${UNCRUSTIFY_PRG} UNCRUSTIFY_PRG false) # Non-fatal so that "lintc" target can depend on it.
if(UNCRUSTIFY_PRG)
add_custom_command(OUTPUT lintuncrustify-cmd APPEND
COMMAND ${CMAKE_COMMAND}
-DUNCRUSTIFY_PRG=${UNCRUSTIFY_PRG}
-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
-DLINT_NVIM_SOURCES=${LINT_NVIM_SOURCES}
-P ${PROJECT_SOURCE_DIR}/cmake/RunUncrustify.cmake)
endif()
add_custom_target(
lintcfull
COMMAND
${LINT_PRG} --suppress-errors=${LINT_SUPPRESS_FILE} ${LINT_NVIM_REL_SOURCES}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
DEPENDS ${LINT_PRG} ${LINT_NVIM_SOURCES} ${LINT_SUPPRESS_FILE}
DEPENDS ${LINT_PRG} ${LINT_NVIM_SOURCES} ${LINT_SUPPRESS_FILE} lintuncrustify
)
add_custom_target(generated-sources DEPENDS