Skip to content

Conversation

@Yeregorix
Copy link
Member

Registering an afterSync task via Idea-Ext plugin has two major drawbacks:

  1. It is persistent, even if VanillaGradle or the task have been removed from the Gradle configuration. This can result an error when trying to sync the project.

Example when removing Kyori Blossom (which suffers from the same problem) from SpongeVanilla and then syncing.
Capture d'écran 2025-10-16 131602

Persisted tasks are shown in Idea "Tasks Activation" window. Example from Sponge. There, the task must be removed manually to fix the above error.
Capture d'écran 2025-10-16 103637

  1. It is slow. To execute the afterSync tasks, Idea starts a second Gradle daemon. The extra JVM and the extra Gradle configuration phases slow down the project sync.

This can be verified by executing command jps (from the JDK) when importing Sponge. A second Gradle daemon appears when Idea starts executing the sync tasks:
Capture d'écran 2025-10-16 104248

PS C:\Users\x> jps
x GradleDaemon
x Jps
x Main
x GradleDaemon

A better alternative is simply to detect when the current Gradle run is due to an Idea project synchronization and to add the sync task to the start parameters.

This is what has been used for years by some other projects:

and yet, no issue has been reported.

I don't have any rigorous performance metrics, but Sponge sync time on my computer goes from ~25s down to ~13s after using the new approach when all tasks are fully cached. As expected, dividing by 2 the number of Gradle daemons, divides by 2 the sync time when we are only running the configuration phases.

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.

1 participant