Added build scripts.
This commit is contained in:
25
build/scripts/clang-tidy.sh
Normal file
25
build/scripts/clang-tidy.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -xe
|
||||
|
||||
if [ ! -f ".clang-tidy" ] ; then
|
||||
echo "Must be run from project root folder!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# first generate the compile commands for clang-tidy to work with
|
||||
scons -Q --unity=disable --compiler=clang compile_commands.json
|
||||
|
||||
mkdir -p cache/jenkins
|
||||
find private -name "*.cpp" > "cache/jenkins/clang-tidy-files"
|
||||
|
||||
# run clang-tidy, but ignore errors for now
|
||||
# clang-tidy reports some errors in headers, we need to filter those out
|
||||
run-clang-tidy -j8 -p . -quiet $(<"cache/jenkins/clang-tidy-files") | tee "cache/jenkins/clang-tidy.log" || true
|
||||
|
||||
# check if there were any errors in our sources
|
||||
if [ $(grep -- "-warnings-as-errors" cache/jenkins/clang-tidy.log | grep -E "private/|public/" -c || true) -ne 0 ] ; then
|
||||
grep -- "-warnings-as-errors" cache/jenkins/clang-tidy.log | grep -E "private/|public/" >&2
|
||||
exit 1
|
||||
else
|
||||
echo "No relevant errors from clang-tidy, hooray!"
|
||||
fi
|
||||
Reference in New Issue
Block a user