Skip to content

Commit

Permalink
Fix printing
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinShalit committed Aug 3, 2016
1 parent b211720 commit d3d5a9c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
21 changes: 13 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import groovy.xml.XmlUtil

buildscript {
repositories {
jcenter()
Expand Down Expand Up @@ -124,23 +126,26 @@ configure(allprojects - project(':ui:linuxLauncher')) {
sourceSets = [sourceSets.main]
excludeFilter = new File(rootDir, "findBugsSuppressions.xml")
effort = "max"
ignoreFailures = true // Error will be reported by checkFindBugsReport
}

task checkFindBugsReport << {
try {
def xmlReport = findbugsMain.reports.getXml()
def slurped = new XmlSlurper().parse(xmlReport.destination)
def bugsFound = slurped.BugInstance.size()
def xmlReport = findbugsMain.reports.getXml().destination
if (findbugsMain.reports.getXml().destination.exists()) {
def bugs = (new XmlParser().parse(xmlReport)).BugInstance
def bugsFound = bugs.size()
if (bugsFound > 0) {
new XmlNodePrinter().printList(slurped.BugInstance.list())
throw new GradleException("$bugsFound FindBugs rule violations were found. See the report at: $xmlReport.destination")
bugs.each { System.out.println(new XmlUtil().serialize(it)) }
throw new GradleException("$bugsFound FindBugs rule violations were found. See the report at: $xmlReport")
}
} catch (Exception e) {

}
}

// tasks.withType(FindBugs) {
// it.finalizedBy checkFindBugsReport
// }
findbugsMain.finalizedBy checkFindBugsReport
findbugsTest.finalizedBy checkFindBugsReport

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Optional;
import java.util.Set;

import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;

import static com.google.common.base.Preconditions.checkNotNull;
Expand Down Expand Up @@ -95,7 +96,7 @@ public ImmutableSet<String> aliases() {
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
Expand Down

0 comments on commit d3d5a9c

Please sign in to comment.