Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Deprecate findbugs #216

Merged
merged 2 commits into from
Nov 21, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ import org.gradle.api.file.FileTree
import org.gradle.api.plugins.quality.FindBugs
import org.gradle.api.plugins.quality.FindBugsExtension
import org.gradle.api.tasks.SourceSet
import org.gradle.util.DeprecationLogger

import java.nio.file.Path

import static com.novoda.staticanalysis.internal.TasksCompat.configureNamed
import static com.novoda.staticanalysis.internal.TasksCompat.createTask

@Deprecated
class FindbugsConfigurator extends CodeQualityConfigurator<FindBugs, FindBugsExtension> {

protected boolean htmlReportEnabled = true

@Deprecated
static FindbugsConfigurator create(Project project,
NamedDomainObjectContainer<Violations> violationsContainer,
Task evaluateViolations) {
Expand Down Expand Up @@ -66,6 +69,7 @@ class FindbugsConfigurator extends CodeQualityConfigurator<FindBugs, FindBugsExt
@Override
protected void configureAndroidWithVariants(DomainObjectSet variants) {
if (configured) return
logDeprecatedMessage()

variants.all { configureVariant(it) }
variantFilter.filteredTestVariants.all { configureVariant(it) }
Expand Down Expand Up @@ -103,6 +107,9 @@ class FindbugsConfigurator extends CodeQualityConfigurator<FindBugs, FindBugsExt

@Override
protected void configureJavaProject() {
if (!configured) {
logDeprecatedMessage()
}
super.configureJavaProject()
project.afterEvaluate {
project.sourceSets.each { SourceSet sourceSet ->
Expand Down Expand Up @@ -172,7 +179,6 @@ class FindbugsConfigurator extends CodeQualityConfigurator<FindBugs, FindBugsExt
}
}


private void createHtmlReportTask(String taskName) {
createTask(project, "generate${taskName.capitalize()}HtmlReport", GenerateFindBugsHtmlReport) { GenerateFindBugsHtmlReport task ->
def findbugs = project.tasks[taskName] as FindBugs
Expand All @@ -186,4 +192,13 @@ class FindbugsConfigurator extends CodeQualityConfigurator<FindBugs, FindBugsExt
private def getAndroidJar() {
"${project.android.sdkDirectory}/platforms/${project.android.compileSdkVersion}/android.jar"
}

private def logDeprecatedMessage() {
DeprecationLogger.nagUserWith(
"Novoda Static Analysis Plugin Findbugs support is deprecated.",
"This is scheduled to be removed in version 2.0",
"Please use SpotBugs instead. https://github.com/novoda/gradle-static-analysis-plugin/blob/master/docs/tools/spotbugs.md",
null
)
}
}