From d7807f64d37e16adf4f93c1b5649a83a243bca4d Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 10 Oct 2022 17:06:43 +0200 Subject: [PATCH] update spotbugs config Signed-off-by: Andy Scherzinger --- app/build.gradle | 49 +++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4c15589ba..840171974 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -120,29 +120,6 @@ android { } } - android.applicationVariants.all { variant -> - String variantName = variant.name - String capVariantName = variantName.substring(0, 1).toUpperCase(Locale.ROOT) + variantName.substring(1) - tasks.register("spotbugs${capVariantName}Report", SpotBugsTask) { - ignoreFailures = true // should continue checking - effort = "max" - reportLevel = "medium" - classes = fileTree("$project.buildDir/intermediates/javac/${variantName}/classes/") - excludeFilter = file("${project.rootDir}/spotbugs-filter.xml") - - reports { - xml { - required = true - } - html { - required = true - outputLocation = file("$project.buildDir/reports/spotbugs/spotbugs.html") - stylesheet = 'fancy.xsl' - } - } - } - } - check.dependsOn 'spotbugsGplayDebug', 'lint', 'ktlintCheck', 'detekt' compileOptions { @@ -349,6 +326,32 @@ task installGitHooks(type: Copy, group: "development") { into '../.git/hooks' } +spotbugs { + ignoreFailures = true // should continue checking + effort = "max" + reportLevel = "medium" +} + +tasks.withType(SpotBugsTask) { task -> + String variantNameCap = task.name.replace("spotbugs", "") + String variantName = variantNameCap.substring(0, 1).toLowerCase() + variantNameCap.substring(1) + + dependsOn "compile${variantNameCap}Sources" + + excludeFilter = file("${project.rootDir}/spotbugs-filter.xml") + classes = fileTree("$project.buildDir/intermediates/javac/${variantName}/classes/") + reports { + xml { + required = true + } + html { + required = true + outputLocation = file("$project.buildDir/reports/spotbugs/spotbugs.html") + stylesheet = 'fancy.xsl' + } + } +} + tasks.named("detekt").configure { reports { html.required.set(true)