mirror of
https://github.com/nextcloud/android.git
synced 2024-11-25 14:45:47 +03:00
Merge pull request #9209 from nextcloud/spotbugs-refactor
build.gradle: Refactor spotbugs setup
This commit is contained in:
commit
a5d4dedc01
3 changed files with 26 additions and 32 deletions
45
build.gradle
45
build.gradle
|
@ -21,7 +21,7 @@ buildscript {
|
|||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.0.3'
|
||||
classpath 'com.hiya:jacoco-android:0.2'
|
||||
classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.5'
|
||||
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.9'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.18.1"
|
||||
classpath "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
|
||||
|
@ -224,26 +224,6 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
String variantName = variant.name
|
||||
String capVariantName = variantName.substring(0, 1).toUpperCase() + 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.enabled = false
|
||||
html {
|
||||
enabled = true
|
||||
destination = file("$project.buildDir/reports/spotbugs/spotbugs.html")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check.dependsOn 'checkstyle', 'spotbugsGplayDebugReport', 'pmd', 'lint', 'ktlint', 'detekt'
|
||||
|
||||
buildFeatures {
|
||||
|
@ -476,3 +456,26 @@ shot {
|
|||
jacoco {
|
||||
toolVersion = "$jacoco_version"
|
||||
}
|
||||
|
||||
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.enabled = false
|
||||
html {
|
||||
enabled = true
|
||||
destination = file("$project.buildDir/reports/spotbugs/spotbugs.html")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
351
|
||||
638
|
||||
|
|
|
@ -47,16 +47,7 @@ require 'xmlsimple'
|
|||
|
||||
# run FindBugs
|
||||
puts "running FindBugs..."
|
||||
system './gradlew assembleGplayDebug 1>/dev/null'
|
||||
|
||||
# confirm that assemble ran w/out error
|
||||
result = $?.to_i
|
||||
if result != 0
|
||||
puts "FAIL: failed to run ./gradlew assembleGplayDebug"
|
||||
exit 1
|
||||
end
|
||||
|
||||
system './gradlew spotbugsGplayDebugReport 1>/dev/null 2>&1'
|
||||
system './gradlew spotbugsGplayDebug 1>/dev/null 2>&1'
|
||||
|
||||
# find FindBugs report file
|
||||
findbugs_reports = Dir.glob(FINDBUGS_REPORT_FILE)
|
||||
|
|
Loading…
Reference in a new issue