79653805

Date: 2025-06-05 04:52:51
Score: 0.5
Natty:
Report link

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)
            }
        }
    }
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): What I
  • Low reputation (1):
Posted by: Jason Withers