Skip to content

Commit

Permalink
Switch to SpotBugs color report
Browse files Browse the repository at this point in the history
The main reason for this switch is that the default stylesheet doesn't
support XSLT 2.0 like it says it does and saxon errors out. I was
originally not using saxon, however when switching to java 11, this
broke.

See the following issues for details
* spotbugs/spotbugs-gradle-plugin#114
* spotbugs/spotbugs#958

Issue #648
  • Loading branch information
jpschewe committed May 26, 2019
1 parent 991bb33 commit 2575cb5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ buildscript {
classpath 'org.unbroken-dome.gradle-plugins:gradle-testsets-plugin:2.1.1'
classpath 'org.kordamp:markdown-gradle-plugin:1.2.0'
classpath 'edu.sc.seis.gradle:launch4j:2.4.4'
classpath 'net.sf.saxon:Saxon-HE:9.9.1-3'
}
configurations.classpath {
exclude group: 'com.google.guava', module: 'guava'
Expand Down Expand Up @@ -380,7 +381,7 @@ spotbugs {
tasks.withType(SpotBugsTask) {
reports {
xml.withMessages true
html.stylesheet resources.text.fromArchiveEntry(configurations.spotbugsStylesheets, 'default.xsl')
html.stylesheet resources.text.fromArchiveEntry(configurations.spotbugsStylesheets, 'color.xsl')
}
task "${it.name}HtmlReport" {
Expand All @@ -390,7 +391,7 @@ tasks.withType(SpotBugsTask) {
def output = file(input.absolutePath.replaceFirst(/\.xml$/, '.html'))
outputs.file output withPropertyName 'output'
doLast {
def factory = TransformerFactory.newInstance()
def factory = TransformerFactory.newInstance('net.sf.saxon.TransformerFactoryImpl', getClass().classLoader)
def transformer = factory.newTransformer(new StreamSource(reports.html.stylesheet.asFile()));
transformer.transform(new StreamSource(input), new StreamResult(output))
}
Expand Down

0 comments on commit 2575cb5

Please sign in to comment.