Sonar Build Wrapper

Hello,

We are currently using sonarqube on our c source file, so far we have used it with a build-wrapper that parsed our make command to create a json file.

But in a specific context we want to run sonarqube on some sources files without having any makefile. However we do have unit tests based on ceedling in that context. The problem is that ceedling doesn’t seems to use makefile but only ruby script to invoke gcc.

Is possible to do something like that, to use our build-wrapper we something other than a makefile? What does exactly the build-wrapper parse to create the .json file?

Thank you very much for your help

Hello @louis.heche,

you can use build-wrapper with any command that invokes the compiler (as long as the compiler is supported). It can be an internal script, it doesn’t have to be a makefile. The only limitation is scripts that can only run on a daemon; they are not supported by build-wrapper.
So if your ruby script can be run without a daemon and invoke gcc, It should work with build-wrapper.

Hope this helps!

Thanks for the reply,

However when I launch the command:

build-wrapper-win-x86-64.exe --out-dir my_dir ceedling test:all

We get the following error:

[SONARSOURCE BUILD-WRAPPER] failed to execute ceedling test:all: No error message has been recorded

But when executing only ceedling test:all we have well all our code builds (though gcc) and executed.

Tested with the ceedling version 0.29

The ceedling command that you are using doesn’t rebuild if the files are not changed. the build-wrapper should be given a command that cleans build your code.

Can you try for the analysis to run the ceedling command that doesn’t run the test after doing a clean:

First run:

ceedling clean

Then run:

build-wrapper-win-x86-64.exe --out-dir my_dir ceedling test:build_only

let me know how it goes.

I tried those two commands (and also some others to be sure that all artifacts are clean), but I still get the same error message.

[SONARSOURCE BUILD-WRAPPER] failed to execute ceedling test:build_only: No error message has been recorded

Here is the content of the build-wrapper.log if it could help you:

Thu Dec 12 08:49:17 2019: build-wrapper, version 4.14 (win-x86-64)
Thu Dec 12 08:49:17 2019: isWow64: 0
Thu Dec 12 08:49:17 2019: windows version: 6.2, service pack: 0.0, build number: 9200, product type: 1
Thu Dec 12 08:49:17 2019: current directory: ***
Thu Dec 12 08:49:17 2019: command line received: <ceedling test:build_only>

Please update your build-wrapper to 6.5 (instead of 4.14).
Let me know if you still face the failure after the update and if it still has the same logs.
Also, are you running the script from the project directory?

I updated the wrapper according to our server version and still got the exact same error:

Thu Dec 12 10:36:48 2019: build-wrapper, version 6.3 (win-x86-64)
Thu Dec 12 10:36:48 2019: isWow64: 0
Thu Dec 12 10:36:48 2019: windows version: 6.2, service pack: 0.0, build number: 9200, product type: 1
Thu Dec 12 10:36:48 2019: current directory: ***
Thu Dec 12 10:36:48 2019: command line received: <ceedling test:build_onlyl>

And yes we executing the script from the project directory. If we are executing this command ceedling test:build_only from the exact same place it works fine.

Is this the full content of the build-wrapper.log ?

yes :slight_smile:

Hello @louis.heche,

Try running ceedling like this:
build-wrapper-win-x86-64.exe --out-dir my_dir ceedling.cmd clean test:build_only
You should run this from the project directory containing ceedling.cmd which run the ruby script.
It was just that you were missing the .cmd

1 Like

Yes this seems to work, thank you