From 498c7646b03ed82db202b3149ce3fb2de64f18e5 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Mon, 7 Aug 2023 19:30:21 +0200 Subject: [PATCH] Add `newLintBaseline` task (#3925) Add a task to regenerate the lint baseline. --- app/build.gradle | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1e67b551b..3c0702d3e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -60,8 +60,7 @@ android { lint { lintConfig file("lint.xml") - // Regenerate by deleting app/lint-baseline.xml, then run: - // ./gradlew lintBlueDebug + // Regenerate by running `./gradlew app:newLintBaseline` 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.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") +}