Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 023ff83

Browse files
brunoabinaderkkaefer
authored andcommitted
[build] Fix 'make tidy' on linux
1 parent c631368 commit 023ff83

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

.clang-tidy

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
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'
1+
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.*'
22
HeaderFilterRegex: '\/mbgl\/'

Makefile

+5-10
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ clang-tools: compdb
168168

169169
.PHONY: tidy
170170
tidy: clang-tools
171-
scripts/clang-tools.sh $(MACOS_OUTPUT_PATH)/$(BUILDTYPE)
171+
scripts/clang-tools.sh $(MACOS_COMPDB_PATH)
172172

173173
.PHONY: check
174174
check: clang-tools
175-
scripts/clang-tools.sh $(MACOS_OUTPUT_PATH)/$(BUILDTYPE) --diff
175+
scripts/clang-tools.sh $(MACOS_COMPDB_PATH) --diff
176176

177177
endif
178178

@@ -304,23 +304,18 @@ coverage: test
304304
compdb: $(LINUX_BUILD)
305305
# Ninja generator already outputs the file at the right location
306306

307-
.PHONY: tidy
308-
tidy: compdb
309-
$(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-headers
310-
scripts/clang-tidy.sh $(LINUX_OUTPUT_PATH)
311-
312307
.PHONY: clang-tools
313-
clang-tools:
308+
clang-tools: compdb
314309
if test -z $(CLANG_TIDY); then .mason/mason install clang-tidy 3.8.0; fi
315310
if test -z $(CLANG_FORMAT); then .mason/mason install clang-format 3.8.0; fi
316-
deps/ninja/ninja-linux -C $(LINUX_OUTPUT_PATH) headers
311+
$(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-headers
317312

318313
.PHONY: tidy
319314
tidy: clang-tools
320315
scripts/clang-tools.sh $(LINUX_OUTPUT_PATH)
321316

322317
.PHONY: check
323-
check: compdb clang-tools
318+
check: clang-tools
324319
scripts/clang-tools.sh $(LINUX_OUTPUT_PATH) --diff
325320

326321
endif

scripts/clang-tools.sh

+7-8
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,14 @@ function check_format() {
4242
export CLANG_TIDY CLANG_FORMAT
4343
export -f check_tidy check_format
4444

45-
git diff-index --quiet HEAD || {
46-
echo "Your repository contains unstaged and/or uncommitted changes."
47-
echo "Please commit all changes before proceeding."
48-
exit 1
49-
}
50-
5145
echo "Running clang checks... (this might take a while)"
5246

53-
if [ -n $2 ] && [ $2 == "--diff" ]; then
47+
if [[ -n $2 ]] && [[ $2 == "--diff" ]]; then
48+
git diff-index --quiet HEAD || {
49+
echo "Your repository contains unstaged and/or uncommitted changes."
50+
echo "Please commit all changes before proceeding."
51+
exit 1
52+
}
5453
DIFF_FILES=$(for file in `git diff origin/master..HEAD --name-only | grep "pp$"`; do echo $file; done)
5554
if [[ -n $DIFF_FILES ]]; then
5655
echo "${DIFF_FILES}" | xargs -I{} -P ${JOBS} bash -c 'check_tidy --fix' {}
@@ -63,6 +62,6 @@ if [ -n $2 ] && [ $2 == "--diff" ]; then
6362
fi
6463
echo "All looks good!"
6564
else
66-
git ls-files '${CDUP}/src/mbgl/*.cpp' '${CDUP}/platform/*.cpp' '${CDUP}/test/*.cpp' | \
65+
git ls-files "${CDUP}/src/mbgl/*.cpp" "${CDUP}/platform/*.cpp" "${CDUP}/test/*.cpp" | \
6766
xargs -I{} -P ${JOBS} bash -c 'check_tidy' {}
6867
fi

0 commit comments

Comments
 (0)