Execute Idea synchronization task in the current Gradle execution #185
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Registering an afterSync task via Idea-Ext plugin has two major drawbacks:
Example when removing Kyori Blossom (which suffers from the same problem) from SpongeVanilla and then syncing.

Persisted tasks are shown in Idea "Tasks Activation" window. Example from Sponge. There, the task must be removed manually to fix the above error.

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: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.