Build-wrapper - multiple projects (modules)

SonarQube 6.7.7
Scanner 4.0.0.1744
build wrapper windows x64

Hello all,
I have a embedded project consisting of three modules. Each of the module is compilable separately. But together they create a firmware. The sources are in C/C++. The compiler used is arm-none-eabi-g++ or arm-none-eabi-gcc version 7.3.1.

My problem is, that sonar-scanner does not see sonar.cfamily.build-wrapper-output parameter in module’s sonar-project.properties file.

I have compiled one of the modules (with build wrapper eavesdropping) and gathered defines, etc. and saved it to root/module1/res/sonarqube/bw_output. Generation was successfull.
Althoug it says:
“compiler”:“clang”,
“executable”:“D:\\root\\_tool\\GCC\\bin\\arm-none-eabi-gcc.exe”,
when I am using arm-none-eabi-gcc. And what’s up with double slashes?

Then I save this path to modules sonar-project file as:
sonar.cfamily.build-wrapper-output=d:/root/module1/res/sonarqube/bw_output
The properties file is saved to root/module1 directory

In main properties file (root/sonar-project.properties) I state I have one module (just for start):
sonar.modules=module1

After I run the scanner I can see that the module’s properties file is seen - because of source files found using sonar.sources=src. But it’s unable to see sonar.cfamily.build-wrapper-output.

I also trier do save output to module’s folder.

Only way to make this work so far is to save this property to main sonar-project.properties, but that is not a solution for me - I have to have separate modules with separate defines, etc.

My questions are following:
Main one:
Why cannot sonar scanner see sonar.cfamily.build-wrapper-output in module’s properties file?
Extra: :slight_smile:
Why is there clang instead of GCC in BW’s output?
Isn’t it wrong to have double slashes in BW’s output?

Hi @peterko91,

the SonarCFamily analyzer is a global sensor which means that it runs only once, you simply have to provide only one sonar.cfamily.build-wrapper-output property at project level, which implies that you have to call the build of the 3 modules from the same command, something equivalent to:

REM from D:\root
build-wrapper-win-x86-64.exe --out-dir bw_output build_all.bat

where build_all.bat contains:

command_to_build_module_1
command_to_build_module_2
command_to_build_module_3

and then call sonar-scanner with just one sonar.cfamily.build-wrapper-output property, something like:

sonar.cfamily.build-wrapper-output=d:/root/bw_output

Implementation detail, GCC and clang compiler share the same cli interface.

No, blackslash character is the escape character, so it needs to be escaped itself.

3 posts were split to a new topic: CFamily multi-configuration analysis