I’m new to SonarCloud, I’ve been trying to scan PRs for a KMM project we have but I’m struggling with the code coverage and some other stuff. Is there a tutorial on how to configure and scan KMM code base including Android, iOS and common code ?
I’ve tried multiple ways to scan the whole project and I end up just using the azure devops SonarCloud scan step after the config.
Currently I have the following steps running in my azure devops pipeline, the code is not public but if necessary I can try to grant you access to the repo
SonarCloudPrepare
SonarCloudAnalyze
SonarCloudPublish
The project is structured as Kotlin Multi-platform mobile project targeting iOS and Android, there are 3 main folders
androidApp: android specific code (mainly UI)
iosApp: iOS specific code (mainly UI)
shared: common and shared code (business logic)
I’ve tried to just configure through the SonarCloudPrepare task then run the gradle build task while enabling the scan, this method didn’t pickup any new iOS code. Do you think I should scan iOS and Android code separately ?
Could you please describe step by step how it should work out of the box for a KMM project ?
It would be really helpful if you can provide a minimal reproducer. A small multiplatform project that described your problem.
Meanwhile, could you please share your Gradle build file (the part with sonar plugin) and clarify what version of the Sonar Gradle plugin you’re using?
Thanks for your message and sorry for the late reply. Could you please send me the link to the project privately as I don’t see any invitation in my mailbox (it might have been filtered out automatically).
We’re currently working on our scanner for Gradle and next week there going to be a version 5.0.
It will simply a little the setup for many projects and fix some issues. So once this is released, I’ll notify you and I’ll ask you to test your project with it and we’ll clarify if some steps are missing.
The main idea is that you have to build your project before analysis and if you want coverage reports you need to execute test tasks before sonar analysis.
Also, make sure that you generate XML reports for coverage as Sonar is reading it.
You can try to test it now. The official announcement will happen later. The main idea is that you build and test it the way how you need it and then run the sonar command.