According to Gradle documentation, it says that there is a guarantee that when apply()
is called on a Plugin<Project>
, that it will always be called with the same project. (It’s possibly a stronger guarantee.)
So, is this safe, then?
abstract class AbstractMyPlugin : Plugin<Project> {
protected lateinit var project: Project
abstract fun doApply()
final override fun apply(project: Project) {
this.project = project
doApply()
}
}