I'm trying to create a gradle plugin that generates some sources when the "Refresh all Gradle projects" button on the Gradle panel. I assume IntelliJ is executing some Gradle target, but I can't find any documentation to figure out which target or targets are executed.
This is for an Android project, and I've heard it suggested to use project.preBuild.dependsOn task, but I have not been able to get that to work every time I refresh (it only works the first time).

If look at the documentation for Intellij IDEA at https://www.jetbrains.com/idea/help/synchronizing-changes-in-gradle-project-and-intellij-idea-project.html
Clicking the refresh button in the gradle tool window does the following:
On pressing this button, IntelliJ IDEA parses the project structure, and displays detected differences (if any) in the Gradle tool window.
It essentially refreshes the project structure from any changes in gradle. It might be difficult to find the specific task that it is calling because under the hood it's using the Gradle Tooling API (https://docs.gradle.org/current/userguide/third_party_integration.html#embedding) to execute all tasks and get info about each project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With