Hi
We are currently updating our Groovy build script to Kotlin (.gradle.kts).
We have the following structure, to avoid duplicating some configuration:
in app/build.gradle
:
...
apply from "${rootProject.rootDir}/settings/lint.xml"
apply from "${rootProject.rootDir}/settings/detekt.xml"
...
android {
...
}
And for example in settings/lint.xml
:
android {
lintOptions {
checkDependencies true
textReport true
htmlReport true
sarifReport true
...
}
}
Same thing for detekt and other plugins.
When trying to do convert theses file to kotlin (dsl?) it didn’t work.
For the lint file, the “android” plugin do not exists in the scope, I got the messages:
* Where:
Script '/home/user/src/android-project/settings/lint.gradle.kts' line: 2
* What went wrong:
Script compilation errors:
Line 02: android {
^ Unresolved reference: android
Line 03: lintOptions {
^ Unresolved reference: lintOptions
Line 04: checkDependencies = true
^ Unresolved reference: checkDependencies
I tried many things, like:
- moving theses script to buildSrc (and use
plugins {id("lint-config")}
inapp/build.gradle.kts
), - Extends the plugins (!!!)
but with no luck.
Any idea ?
Thanks !