Be Among the 20% of the Best!

Jenkins Clang Scan-Build plugin: support matrix builds

| comments

I’m using Jenkins to build iOS projects (as you may have noticed from my previous jenkins posts). One of build steps that can help developers is running the Clang scan-build static analyzer and publishing the results. Luckily, there is an existing Clang Scan-Build Jenkins plugin available, however it hasn’t been updated for a while. I stumbled upon Sean Wang’s blog post ( describing his fixes for latest Xcode. That’s a great update!

So it worked fine until I needed to use it in a matrix (aka multi-configuration) project. It was missing from the list of available build steps! One solution is to emulate the matrix build by having N regular builds, one for each of the configurations, to run the analyzer, but that would be very painful to maintain.

It turned out to be quite easy to patch the plugin to support matri projects. The source code is available in my fork: I have also fixed tests there.

You can either download the patched plugin built by me or build it yourself. The binary is here clang-scanbuild-plugin.hpi and its SHA256SUM is:

0c5b12b1cd95c2b66426a5b719c496c5c18d1918cf33ca56a490df17e9b5e6a5  clang-scanbuild-plugin.hpi

To build it you can use these commands:

# install maven if you don't have it
brew install maven

git clone --depth 1
cd clang-scanbuild-plugin/
mvn clean package

You’ll find the clang-scanbuild-plugin.hpi file in the target directory.

To install, go to Manage Jenkins > Manage Plugins > Advanced, select the clang-scanbuild-plugin.hpi file in the Upload Plugin section, and click Upload. Done.

FYI: to install scan-build on OSX without building the whole LLVM and obviously without downloading manually, is to use this command:

brew install