Switch from groovy to kotlin

I try to switch from groovy to kotlin, I want to know how to switch from groovy to kotlin in buildSrc, such as the plugin “groovy-gradle-plugin”, what should the corresponding kotlin look like
I want to switch the plugin written in groovy to kotlin
can someone give me an answer

You can use java-gradle-plugin and also apply the Kotlin JVM plugin with the embedded Kotlin version like compileOnly(embeddedKotlin("jvm")) and it should be comparable.
If you also want to write precompiled script plugins in Kotlin you might want to use the kotlin-dsl plugin instead.
Or if you just want normal Kotlin plugins, but also use the Kotlin DSL extensions, you might just want to use compileOnly(gradleKotlinDsl()).

The kotlin-dsl plugin applies java-gradle-plugin , kotlin-dsl.base , and kotlin-dsl.precompiled-script-plugins plugins
kotlin-dsl.base plugin applies embedded-kotlin , adds gradleKotlinDsl() to the dependencies of compileOnly and testImplementation configurations, and configures the Kotlin DSL compiler plugins for example for proper SAM conversion for Action and similar.