Gradle scanner v4.3.0.3225 launches several `prepareKotlinBuildScriptModel` increasing build time

Hi,

We just updated the sonar gradle scanner plugin to latest version v4.3.0.3225.

This produced that the sonarqube task started to spawn several of Gradle processes invoking the task prepareKotlinBuildScriptModel, from the amount of tasks we see, we strongly believe that this is creating one per module.

Even if this task is fairly fast (~5 seconds), it launches one per module in serial. This means that for a project with 120 modules it increase the total duration by ~10min, which is a big penalty in execution time. We have more modules and this problem literally duplicated our CI checks time.

This is hard to spot at it happens internally in the sonar process and there is no log output, however we have Gradle Enterprise in the project and we noticed thousands of reports from this task from CI (which never happened before with current volume as this is part of the IDE sync). So the only way we have to spot this is thanks to the gradle scans.

I don’t think this is relevant, but just for context: this is an Android project, all in kotlin, in Github, executed in Jenkins, running Sonarcloud.

As a side note, in the release notes was not mentioned anything related to this change. We found out just because lucky we have GE scans and we were able to trace it back to the sonarqube plugin update and see the task reports. I can imagine many people facing big build time increases having hard time to understand why. Is there any where else were we could find the release notes? if not, I would really appreciate sharing more details in them :slight_smile:

2 Likes

Hello @rolgalan_g,

Thanks for your message. And your investigation.

The point is that you stepped in the problem with the feature that was implemented in 2 projects Gradle scanner and Kotlin analyzer. Recently we added a new Sensor to analyze your Gradle build scripts written in Kotlin. As it’s Kotlin code, the rules. and the Sensor is here: Releases · SonarSource/sonar-kotlin · GitHub. However, to enable this feature to work without any configuration we needed to apply changes in the scanner here: Release 4.3.0 · SonarSource/sonar-scanner-gradle · GitHub

Currently, I created a few tickets to improve this feature:

https://sonarsource.atlassian.net/browse/SONARKT-353
https://sonarsource.atlassian.net/browse/SONARGRADL-128

Meanwhile, you can use the previous version of Gradle scanner, and wait till the next version is released.

Regards,
Margarita

3 Likes

Thanks for the quick answer @Margarita_Nedzelska. We already reverted to the previous version before reporting here. Looking forward for that update. :slight_smile:

2 Likes