What happens when Double Clicking a Task in the Gradle Plugin?

What code is executed when, for example, the task buildPlugin is double-clicked in the menu below?

image
I would like to build a plugin for Android Studio that can be used to execute some commonly used gradle tasks. In theory, it should perform exactly the same as executing (double-clicking) a task through the Gradle toolbar.

Does it only execute the below line in a terminal:

gradlew buildPlugin

?

If there is more to it, where can I find the source code for this?

Thank you very much, any help is appreciated.