What I did was create a Project extension function configureLint that takes in a CommonExtension (both LibraryExtension and ApplicationExtension implements CommonExtension):
internal fun Project.configureLint(commonExtension: CommonExtension<*, *, *, *, *, *>){
with(commonExtension) {
lint {
abortOnError = false
...
}
}
}
Then applied to to both the AppPlugin and LibraryPlugin that I've defined using ApplicationExtension and LibraryExtension respectively:
class AppPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
extensions.configure<ApplicationExtension> {
configureLint(this)
}
}
}
}
class LibraryPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
extensions.configure<LibraryExtension> {
configureLint(this)
}
}
}
}