Anyone familiar with creating `Gradle Plugin`s? I...
# multiplatform
m
Anyone familiar with creating `Gradle Plugin`s? I'm trying to do something on closure.
Copy code
plugins {
    id("my-plugin")
}

myPluginExtension {
    // Configure it
}

// I'm trying to ensure that at this line here in the build.gradle(kts) file (after closure), everything gets configured
Copy code
open class MyPlugin: Plugin<Project> {
    override fun apply(target: Project) {
        val extension = target.extensions.create(
            "myPluginExtension",
            MyPluginExtension::class.java,
            target,
        )
        
        // What I'm trying to do, much like an action
        // that gets lazily invoked.
        extension.afterClosure { it ->
             it.configure()
        }
    }

    private val MyPluginExtension.configure() {
        // setup
    }
}
e
Probably better off asking in the #gradle channel, but that's only meant for Kotlin + Gradle discussions. Gradle has their own Slack https://gradle-community.slack.com/signup#/domain-signup
b
What you need is gradle's lazy Property and Provider to store data
m