I'm writing a precompiled plugin to apply the Lint...
# gradle
f
I'm writing a precompiled plugin to apply the Lint rules to the modules on my app. On Groovy you'd call
Copy code
dependencies {
    lintChecks("com.slack.lint.compose:compose-lint-checks:1.0.0")
}
in the
android
block but in Kotlin this doesn't work, it complains that I need to pass a
Closure
. How can I call
lintChecks
in Kotlin? I'm pasting the whole code in the thread
Copy code
import com.android.build.gradle.LibraryExtension
import org.gradle.api.Action
import org.gradle.api.Project
import org.gradle.api.plugins.ExtensionAware

internal fun Project.configureAndroidLint(
    commonExtension: LibraryExtension,
) {
    commonExtension.apply {
        androidOptions {
            dependencies {
                lintChecks("com.slack.lint.compose:compose-lint-checks:1.0.0")
            }
            lint {
                quiet = false
                abortOnError = true
                checkDependencies = true
                ignoreTestSources = true
                warningsAsErrors = true
                lintConfig = file(rootDir.path + "/testing/lint/lint-config.xml")
                htmlOutput = file("${project.buildDir}/reports/lint/lint.html")
            }
        }
    }
}

private fun Project.androidOptions(block: Action<LibraryExtension>): Unit =
    (this as ExtensionAware).extensions.configure("android", block)
m
I think you need to add it without using
lintChecks
type-safe accessor:
Copy code
dependencies.add("lintChecks", "com.slack.lint.compose:compose-lint-checks:1.0.0")
f
that worked, thanks!
b
Also "lintCheck"("coordinates") is available (works via add("configuration","notation")
f
how would you use
lintCheck
? When I tried it didn't resolve