Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazily register sonar and sonarqube tasks #242

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GreyTeardrop
Copy link
Contributor

Replace eager task registration via TaskContainer.create() with lazy registration via TaskContainer.register().

Motivation: analyzing a build scan, I've noticed that my build had 2 tasks created immediately. Those turned out to be sonar and sonarqube.

CleanShot 2024-07-13 at 00 31 05@2x

It would be great to avoid creating those tasks if SonarScanner isn't executed.

Replace eager task registration via TaskContainer.create() with lazy
registration via TaskContainer.register().
Copy link

@pwagland pwagland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me, and saves small amount of time per project. When you have hundreds or thousands to project these small bits add up. The tasks are correctly configured lazily.

@dorian-burihabwa-sonarsource
Copy link
Contributor

We need to check that the API is compatible with the lowest version of Gradle we support 5.6.4

@GabrielFleischer
Copy link

A ticket has been created, it will be taken care of in a future sprint.

https://sonarsource.atlassian.net/browse/SCANGRADLE-158

@GreyTeardrop
Copy link
Contributor Author

GreyTeardrop commented Oct 15, 2024

We need to check that the API is compatible with the lowest version of Gradle we support 5.6.4

As far as I can see, configuration avoidance methods including TaskContainer.register() were first introduced in Gradle 4.9 and made stable in Gradle 5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants