Commit 9c2cf6f8 authored by Alexander Wiebel's avatar Alexander Wiebel

[FIX] make stylecheck abort if it detects error (again)

parent 0658126e
......@@ -272,16 +272,16 @@ FUNCTION( SETUP_STYLECHECKER _TargetName _CheckFiles _Excludes )
SET( BrainLinterCommandFile_Errors "${PROJECT_BINARY_DIR}/brainlint/brainlintcommand_errors_${_TargetName}" )
FILE( WRITE ${BrainLinterCommandFile_Errors} "#!/bin/bash\n declare BRAINLINTFILES=$(cat ${BrainLinterListFile}); for B_FILE in $BRAINLINTFILES; do B_FILE=$(echo $B_FILE | tr -d '\r'); ${PROJECT_SOURCE_DIR}/../tools/style/brainlint/brainlint.py ${STYLECHECK_OPTIONS} $B_FILE;done 2>&1 | grep -iv 'Total errors found: 0$' | cat")
SET( BrainLinterCommandFile_Exitcode "${PROJECT_BINARY_DIR}/brainlint/brainlintcommand_exitcode_${_TargetName}" )
FILE( WRITE ${BrainLinterCommandFile_Exitcode} "#!/bin/bash\n declare BRAINLINTFILES=$(cat ${BrainLinterListFile}); for B_FILE in $BRAINLINTFILES; do B_FILE=$(echo $B_FILE | tr -d '\r'); ${PROJECT_SOURCE_DIR}/../tools/style/brainlint/brainlint.py ${STYLECHECK_OPTIONS} $B_FILE;done 2>&1| grep -qi 'Total errors found: 0$'")
FILE( WRITE ${BrainLinterCommandFile_Exitcode} "#!/bin/bash\n declare BRAINLINTFILES=$(cat ${BrainLinterListFile}); for B_FILE in $BRAINLINTFILES; do B_FILE=$(echo $B_FILE | tr -d '\r'); ${PROJECT_SOURCE_DIR}/../tools/style/brainlint/brainlint.py ${STYLECHECK_OPTIONS} $B_FILE;done 2>&1| grep -iv 'Total errors found: 0$'|grep -qi 'Total';! $(exit $?)")
# add a new target for this lib
ADD_CUSTOM_TARGET( stylecheck_${_TargetName}
# The following COMMAND will cause printing of the errors if there are errors
# and no ouput if no errors occured (not even the number of errors, i.e. 0)
COMMAND ${BrainLinterCommandFile_Errors}
COMMAND bash ${BrainLinterCommandFile_Errors}
# The following COMMAND will cause will produce the exit code corresponding to
# whether there have been errors (2) or not (0).
COMMAND ${BrainLinterCommandFile_Exitcode}
COMMAND bash ${BrainLinterCommandFile_Exitcode}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Check if ${_TargetName} complies to CodingStandard"
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment