Skip to content

Conversation

@romainbrenguier
Copy link
Contributor

@romainbrenguier romainbrenguier commented Nov 18, 2025

Summary

Uniformize library computation across all project types by moving it to SonarResolverTask configuration phase.

Previously, only Android projects computed libraries in SonarResolverTask, while non-Android projects computed them in SonarPropertyComputer because of a parallel execution issues with Gradle 9.1.0 (SCANGRADLE-292).
This issue could potentially also happen for non-Android project, which we aim to address with this PR.

Now all projects (Android and non-Android) compute libraries during task configuration in SonarResolverTask, making it safe for parallel execution.

Changes

  • Move getRuntimeJars() methods to SonarUtils for reuse
  • Add setJavaLibrariesProperties() to configure libraries for non-Android projects
  • Remove library computation from SonarPropertyComputer

This pull request is based on #391, and needs to be rebased before review.

Please be aware that we are not actively looking for feature contributions. The truth is that it's extremely difficult for someone outside SonarSource to comply with our roadmap and expectations. Therefore, we typically only accept minor cosmetic changes and typo fixes. If you would like to see a new feature, please create a new thread in the forum "Suggest new features".

With that in mind, if you would like to submit a code contribution, make sure that you adhere to the following guidelines and all tests are passing:

  • Please explain your motives to contribute this change: what problem you are trying to fix, what improvement you are trying to make
  • Use the following formatting style: SonarSource/sonar-developer-toolset
  • Provide a unit test for any code you changed
  • If there is a JIRA ticket available, please make your commits and pull request start with the ticket ID (SONARGRADL-XXXX)

We will try to give you feedback on your contribution as quickly as possible.

Thank You!
The SonarSource Team

@hashicorp-vault-sonar-prod
Copy link

hashicorp-vault-sonar-prod bot commented Nov 18, 2025

SCANGRADLE-317

@romainbrenguier romainbrenguier force-pushed the romain/317-libraries branch 2 times, most recently from 8a860dc to 0cc9173 Compare November 18, 2025 13:15
romainbrenguier and others added 6 commits November 18, 2025 15:30
Move getRuntimeJars(), getRuntimeJar(), and getFxRuntimeJar() methods
from SonarPropertyComputer to SonarUtils to make them reusable across
the codebase. This is a preparation step for uniformizing library
computation in SonarResolverTask for all project types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…Android projects

Remove getRuntimeJars(), getRuntimeJar(), and getFxRuntimeJar() methods
from SonarPropertyComputer as library computation is now handled in
SonarResolverTask for both Android and non-Android projects.

Also refactor SonarUtils helper methods:
- Rename setMainClasspathProps to setMainBinariesProps and remove
  library parameters
- Remove setTestClasspathProps and inline test binaries setting

Add library computation for non-Android projects in SonarResolverTask
by introducing setJavaLibrariesProperties() method that sets both main
and test libraries to Java/JavaFX runtime jars.

This uniformizes library computation across all project types:
- Android projects: libraries resolved from Android dependencies
- Non-Android projects: libraries resolved from Java/JavaFX runtime jars

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Remove the outdated comment about libraries only being populated for
Android projects, as libraries are now computed in SonarResolverTask
for all project types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
To avoid code duplication
@romainbrenguier romainbrenguier marked this pull request as ready for review November 18, 2025 15:00
@sonarqube-next
Copy link

@romainbrenguier romainbrenguier merged commit 9712729 into master Nov 19, 2025
36 checks passed
@romainbrenguier romainbrenguier deleted the romain/317-libraries branch November 19, 2025 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants