Any good idea how to run clang tidy in Android build

222 views
Skip to first unread message

butter

unread,
Apr 2, 2018, 4:34:10 PM4/2/18
to android-ndk
Hi, 

     I  want to run clang-tidy in Android build and want to integrated  to my CI , the question I meet is that there seems no quick way to run it, I tried:

1. manually scan files and add -I ,but that not good way for many repos to generate
2. tried with run run-clang-tidy.py  in prebuilts  but seem it need  compile_commands.json file for input, and all instruction I googled are for Cmake or makefile(bear)
3.tried ninja -t compdb way from LLVM website  , and it turns out phrase nothing out in my build.ninja file in out/ generated from Android build

Is there any good way to run clang tidy in Android build?

BRs,

butter

Dan Albert

unread,
Apr 2, 2018, 4:37:15 PM4/2/18
to android-ndk
If you're using ndk-build, this support is actually built in for r18 (not released yet, but if you're feeling adventurous you could try patching the relevant commit into your copy of ndk-build): https://android-review.googlesource.com/c/platform/ndk/+/632426

You could also grab a canary build: https://android.googlesource.com/platform/ndk/+/master/docs/ContinuousBuilds.md. I definitely would not recommend using a canary NDK for a production build though.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/f16175fa-7c67-4b59-975e-9c4c6660083f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Norm Evangelista

unread,
May 31, 2018, 10:52:49 PM5/31/18
to android-ndk
But how do you enable clang-tidy checks for your own (native) code? I believe that's what the OP is asking.

Dan Albert

unread,
May 31, 2018, 11:15:17 PM5/31/18
to android-ndk
Exactly as shown in the patch above (look at the test case).

r18 isn't quite in beta yet though, so it's still not really available.

Reply all
Reply to author
Forward
0 new messages