[build] Fix 'make tidy' on linux
This commit is contained in:
committed by
Konstantin Käfer
parent
c6313681d2
commit
023ff83d88
@@ -1,2 +1,2 @@
|
||||
Checks: 'modernize-*,misc-static-assert,llvm-namespace-comment,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.uninitialized.UndefReturn,-clang-analyzer-core.StackAddressEscape,-clang-analyzer-core.CallAndMessage'
|
||||
Checks: 'modernize-*,misc-static-assert,llvm-namespace-comment,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.uninitialized.UndefReturn,-clang-analyzer-core.StackAddressEscape,-clang-analyzer-core.CallAndMessage,-clang-diagnostic-unused-command-line-argument,-clang-analyzer-core.uninitialized.*'
|
||||
HeaderFilterRegex: '\/mbgl\/'
|
||||
|
||||
15
Makefile
15
Makefile
@@ -168,11 +168,11 @@ clang-tools: compdb
|
||||
|
||||
.PHONY: tidy
|
||||
tidy: clang-tools
|
||||
scripts/clang-tools.sh $(MACOS_OUTPUT_PATH)/$(BUILDTYPE)
|
||||
scripts/clang-tools.sh $(MACOS_COMPDB_PATH)
|
||||
|
||||
.PHONY: check
|
||||
check: clang-tools
|
||||
scripts/clang-tools.sh $(MACOS_OUTPUT_PATH)/$(BUILDTYPE) --diff
|
||||
scripts/clang-tools.sh $(MACOS_COMPDB_PATH) --diff
|
||||
|
||||
endif
|
||||
|
||||
@@ -304,23 +304,18 @@ coverage: test
|
||||
compdb: $(LINUX_BUILD)
|
||||
# Ninja generator already outputs the file at the right location
|
||||
|
||||
.PHONY: tidy
|
||||
tidy: compdb
|
||||
$(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-headers
|
||||
scripts/clang-tidy.sh $(LINUX_OUTPUT_PATH)
|
||||
|
||||
.PHONY: clang-tools
|
||||
clang-tools:
|
||||
clang-tools: compdb
|
||||
if test -z $(CLANG_TIDY); then .mason/mason install clang-tidy 3.8.0; fi
|
||||
if test -z $(CLANG_FORMAT); then .mason/mason install clang-format 3.8.0; fi
|
||||
deps/ninja/ninja-linux -C $(LINUX_OUTPUT_PATH) headers
|
||||
$(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-headers
|
||||
|
||||
.PHONY: tidy
|
||||
tidy: clang-tools
|
||||
scripts/clang-tools.sh $(LINUX_OUTPUT_PATH)
|
||||
|
||||
.PHONY: check
|
||||
check: compdb clang-tools
|
||||
check: clang-tools
|
||||
scripts/clang-tools.sh $(LINUX_OUTPUT_PATH) --diff
|
||||
|
||||
endif
|
||||
|
||||
@@ -42,15 +42,14 @@ function check_format() {
|
||||
export CLANG_TIDY CLANG_FORMAT
|
||||
export -f check_tidy check_format
|
||||
|
||||
git diff-index --quiet HEAD || {
|
||||
echo "Your repository contains unstaged and/or uncommitted changes."
|
||||
echo "Please commit all changes before proceeding."
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "Running clang checks... (this might take a while)"
|
||||
|
||||
if [ -n $2 ] && [ $2 == "--diff" ]; then
|
||||
if [[ -n $2 ]] && [[ $2 == "--diff" ]]; then
|
||||
git diff-index --quiet HEAD || {
|
||||
echo "Your repository contains unstaged and/or uncommitted changes."
|
||||
echo "Please commit all changes before proceeding."
|
||||
exit 1
|
||||
}
|
||||
DIFF_FILES=$(for file in `git diff origin/master..HEAD --name-only | grep "pp$"`; do echo $file; done)
|
||||
if [[ -n $DIFF_FILES ]]; then
|
||||
echo "${DIFF_FILES}" | xargs -I{} -P ${JOBS} bash -c 'check_tidy --fix' {}
|
||||
@@ -63,6 +62,6 @@ if [ -n $2 ] && [ $2 == "--diff" ]; then
|
||||
fi
|
||||
echo "All looks good!"
|
||||
else
|
||||
git ls-files '${CDUP}/src/mbgl/*.cpp' '${CDUP}/platform/*.cpp' '${CDUP}/test/*.cpp' | \
|
||||
git ls-files "${CDUP}/src/mbgl/*.cpp" "${CDUP}/platform/*.cpp" "${CDUP}/test/*.cpp" | \
|
||||
xargs -I{} -P ${JOBS} bash -c 'check_tidy' {}
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user