gradle / gradle-native

The home of Gradle's support for natively compiled languages
https://blog.gradle.org/introducing-the-new-cpp-plugins
Apache License 2.0
93 stars 8 forks source link

Plugin author can write static analyzer plugins for native code #152

Open lacasseio opened 7 years ago

lacasseio commented 7 years ago

Native developers often rely on various static analyzers. These analyzers need access to the argument used during compilation. Some compiler options aren't accessible to the plugin author as they are handled by the tool chain as opposed to the compile task.

Expected Behavior

Gradle native model should expose enough public APIs to enable users to write static analyzer plugins support for Gradle.

Test Cases

Please comment on this epic static analyzers to consider in this work.

ddresser commented 7 years ago

I am currently trying to integrate 'clang-tidy' which requires a compilation database with the full compiler command. Here is an example of the compilation database:

Here is an example compile database for clang-tidy. This is what I would like to generate.

[ { "directory": "/root/gradle_clang_test", "command": "/usr/bin/clang++ -x c++ -c -I /root/gradle_clang_test/src/hello/headers clang_test.cpp", "file": "/root/gradle_clang_test/clang_test.cpp", }, { "directory": "/root/gradle_clang_test", "command": "/usr/bin/clang++ -x c++ -c -DFOO -I /root/gradle_clang_test/src/hello/headers clang_test2.cpp", "file": "/root/gradle_clang_test/clang_test2.cpp", } ]