Add `newLintBaseline` task (#3925)

Add a task to regenerate the lint baseline.
This commit is contained in:
Nik Clayton 2023-08-07 19:30:21 +02:00 committed by GitHub
parent 5d4c14aed9
commit 498c7646b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 2 deletions

View File

@ -60,8 +60,7 @@ android {
lint { lint {
lintConfig file("lint.xml") lintConfig file("lint.xml")
// Regenerate by deleting app/lint-baseline.xml, then run: // Regenerate by running `./gradlew app:newLintBaseline`
// ./gradlew lintBlueDebug
baseline = file("lint-baseline.xml") baseline = file("lint-baseline.xml")
} }
@ -203,3 +202,18 @@ tasks.withType(org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask) {
"--add-opens", "jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", "--add-opens", "jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-opens", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"]) "--add-opens", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"])
} }
tasks.register("newLintBaseline") {
description 'Deletes and then recreates the lint baseline'
// This task should always run, irrespective of caching
notCompatibleWithConfigurationCache("Is always out of date")
outputs.upToDateWhen { false }
doLast {
delete android.lint.baseline.path
}
// Regenerate the lint baseline
it.finalizedBy tasks.named("lintBlueDebug")
}