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

Commit

Permalink
Deprecate findbugs (#216)
Browse files Browse the repository at this point in the history
Deprecate findbugs
  • Loading branch information
zegnus authored Nov 21, 2019
2 parents 6d83da7 + 89f179f commit 55fe6b1
Showing 1 changed file with 16 additions and 1 deletion.
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
)
}
}

0 comments on commit 55fe6b1

Please sign in to comment.