Combined Scan Multi Language Project

Hi,

We have a number of multi language (C#, Java and Objective-C) repositories. Is it possible to create an aggregated scan pipeline?

I know I can build the C# project with the MSBuild tools, I can use the Gradle builder to handle Java, and I think I can use the SonarScanner CLI to handle Objective-C. But I am unsure in how to aggregate all of these scans into a single project, or if this is even possible.

Any advice/insight is appreciated.

Thanks

Hi,

Welcome to the community!

What you’ve described is generally the default behavior. Where that falls down is when we implement analysis on top of opinionated build tools such as Maven and MSBuild. :frowning:

Unfortunately, when analysis asks them “where are the source files” (i.e. the value of sonar.sources) they default to only responding with files for their languages.

The docs address handling this for SonarScanner for .NET. For any other scanner, you just override the default sonar.sources value on the analysis command line by adding `-Dsonar.sources=[comma-delimited list of source directories]

 
HTH,
Ann

@Steve_Conner Small addendum: it is possible to scan C# and C-family (C/C++/Objective-C) projects. See C/C++/Objective-C: Solution with a mix of C# and C++.

Your next step would be to then combine the Java build or at least the sonar.java.binaries for the Sonar scanner to .NET to recognize.

Regarding Ann’s earlier comment:

Not all Sonar scanners work this way, at least, for example, the Sonar scanner for Gradle.

For Sonar Scanner for Gradle, you have to find a Gradle DSL method to add the source sets that are not the defaults or follow this method Analyzing custom source sets or adding logic to subprojects or use ext property.

The takeaway: be careful how you include all files to scan and check our documentation for more information. If you are still confused, please post a follow-up here (or for anyone else reading this thread).