Method for plugins{}

I think every script block has a corresponding method behind it. (Am I right?)
but for the script block:

plugins{...}

I could not find that method.
Can someone help me explain it?

Thanks.

In a build.gradle file, both plugins { ... } and buildscript { ... } are special because they must be evaluated/executed in order to determine the classpath that is used for the execution of the rest of the script. Therefore, you will not find a plugins method in the usual locations.

Instead, Gradle uses an AST library to find these special blocks first and apply them as needed before the rest of the script executes. After the AST transform, the plugins { ... } block itself is applied to the script, which is a PluginsAwareScript. The contents of the block are defined by PluginDependenciesSpec.

@jjustinic, thank you for your reply.
When you say “AST”, I thought it is a translation Closure to method call, right?
I think for buildscript { } , there is a java method for project called buildscript​(Closure configureClosure)
So the AST translate this “buildscript{}” to “buildscript method”.
But, I can not find the “plugins” method in anywhere.