mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
build(lint): check uncrustify version #19468
This to prevent the user from accidentally using the wrong uncrustify version.
This commit is contained in:
parent
e12c62c1f7
commit
e12035fc0c
13
cmake/CheckUncrustifyVersion.cmake
Normal file
13
cmake/CheckUncrustifyVersion.cmake
Normal file
@ -0,0 +1,13 @@
|
||||
if(UNCRUSTIFY_PRG)
|
||||
execute_process(COMMAND uncrustify --version
|
||||
OUTPUT_VARIABLE user_version
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE "[A-Za-z_#-]" "" user_version ${user_version})
|
||||
|
||||
file(STRINGS ${CONFIG_FILE} required_version LIMIT_COUNT 1)
|
||||
string(REGEX REPLACE "[A-Za-z_# -]" "" required_version ${required_version})
|
||||
|
||||
if(NOT user_version STREQUAL required_version)
|
||||
message(FATAL_ERROR "Wrong uncrustify version! Required version is ${required_version} but found ${user_version}")
|
||||
endif()
|
||||
endif()
|
@ -789,6 +789,12 @@ foreach(sfile ${LINT_NVIM_SOURCES})
|
||||
endforeach()
|
||||
add_custom_target(lintc DEPENDS ${LINT_TARGETS})
|
||||
|
||||
add_custom_target(uncrustify-version
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D UNCRUSTIFY_PRG=${UNCRUSTIFY_PRG}
|
||||
-D CONFIG_FILE=${PROJECT_SOURCE_DIR}/src/uncrustify.cfg
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/CheckUncrustifyVersion.cmake)
|
||||
|
||||
add_glob_targets(
|
||||
TARGET lintuncrustify
|
||||
COMMAND ${UNCRUSTIFY_PRG}
|
||||
@ -796,6 +802,8 @@ add_glob_targets(
|
||||
FILES ${LINT_NVIM_SOURCES}
|
||||
)
|
||||
|
||||
add_dependencies(lintuncrustify uncrustify-version)
|
||||
|
||||
add_custom_target(
|
||||
lintcfull
|
||||
COMMAND
|
||||
|
Loading…
Reference in New Issue
Block a user