import org.gradle.api.plugins.ExtensionAware import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.findByType inline fun ExtensionAware.configureIf(crossinline block: T.() -> Unit) { if (extensions.findByType() != null) { extensions.configure { block() } } }