'In the Gradle, How to logic of getting the plugins scope using by id(...)

In Android Project, When my project structure is as follows. picture1

Doesn't plugins{} method returned PluginDependenciesSpecScope? picture2

But In the code, method that plugins parameter is as below. It's means In the lambda plugins{ id... } receiver is PluginDependenciesSpecScope picture3

so We will typing id("org...")in plugins method, then load plugin (from parent project's dependencies or etc..)

but, I don't know where idis called. If I looks in the code, PluginDependenciesSpecScope's parameter is private val plugins: PluginDependenciesSpec and function id(id: String) call plugins that private parameter in internal constructor . However, PluginDependenciesSpecScope has not been initialized anywhere. Just called by Receiver for the plugins block. How to it work?

@GradleDsl
class PluginDependenciesSpecScope internal constructor(
    private val plugins: PluginDependenciesSpec
) : PluginDependenciesSpec {

    override fun id(id: String): PluginDependencySpec =
        plugins.id(id)
}

My English is a little poor, but I ask for your understanding.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source