From 4c8128eaa903575a46cc069ea9da3c001f55fb2b Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 30 Jan 2016 10:43:58 +0100 Subject: [PATCH] Make errors from LDoc fatal Via this commit, any warnings from LDoc are fatal and make "make" fail. The intention is to cause failures on Travis for PRs that introduce broken documentation. Closes: https://github.com/awesomeWM/awesome/issues/643 Signed-off-by: Uli Schlachter --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47d19f377..762084298 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -259,8 +259,12 @@ if(GENERATE_DOC) file(GLOB_RECURSE AWE_LUA_FILES ${BUILD_DIR}/lib/*.lua) file(GLOB_RECURSE AWE_MD_FILES ${AWE_DOC_DIR}/*.md) + # Run ldoc and make it fail if any warnings are generated. The + # redirection-magic swaps stdout and stderr and awk exits with a non-zero + # status if it sees at least one line of input. + # All together, this fails as soon as ldoc prints on stderr. add_custom_target(ldoc ALL - COMMAND ${LDOC_EXECUTABLE} . + COMMAND ${LDOC_EXECUTABLE} . 3>&1 1>&2 2>&3 | awk "{ fail=1 \; print } END { exit fail }" WORKING_DIRECTORY ${AWE_DOC_DIR} DEPENDS ${AWE_LUA_FILES} ${AWE_MD_FILES}) endif()