Update the html task to use the built-in findbugs xsl
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/a8862998 Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/a8862998 Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/a8862998 Branch: refs/heads/master Commit: a8862998fb47d478000e675dcaf8a238818259aa Parents: 3e3c12c Author: Peter Donald <[email protected]> Authored: Sat Jul 26 07:26:09 2014 +1000 Committer: Peter Donald <[email protected]> Committed: Sat Jul 26 07:26:09 2014 +1000 ---------------------------------------------------------------------- CHANGELOG | 2 ++ addon/buildr/findbugs.rb | 40 +++++++++++++++++----------------------- 2 files changed, 19 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/buildr/blob/a8862998/CHANGELOG ---------------------------------------------------------------------- diff --git a/CHANGELOG b/CHANGELOG index ab391ec..dbf45a1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,6 @@ 1.4.20 (Pending) +* Change: Update the findbugs addon to use the built-in findbugs stylesheet + to generate the html report. * Fixed: Ensure that the 'source_paths' and 'extra_dependencies' properties in the findbugs addon does not contain arrays or nils. * Fixed: Ensure that the 'single_intermediate_layout' addon removes the top http://git-wip-us.apache.org/repos/asf/buildr/blob/a8862998/addon/buildr/findbugs.rb ---------------------------------------------------------------------- diff --git a/addon/buildr/findbugs.rb b/addon/buildr/findbugs.rb index 7eb4688..3fd30af 100644 --- a/addon/buildr/findbugs.rb +++ b/addon/buildr/findbugs.rb @@ -51,7 +51,6 @@ module Buildr args = { :output => options[:output] || 'xml', :outputFile => output_file, - :output => "xml:withMessages", :effort => 'max', :pluginList => '', :classpath => cp, @@ -100,10 +99,6 @@ module Buildr !!@enabled end - def html_enabled? - File.exist?(self.style_file) - end - attr_writer :config_directory def config_directory @@ -134,12 +129,6 @@ module Buildr @html_output_file || "#{self.report_dir}/findbugs.html" end - attr_writer :style_file - - def style_file - @style_file || "#{self.config_directory}/findbugs-report.xsl" - end - attr_writer :filter_file def filter_file @@ -196,6 +185,7 @@ module Buildr :extra_dependencies => project.findbugs.extra_dependencies } options[:exclude_filter] = project.findbugs.filter_file if File.exist?(project.findbugs.filter_file) + options[:output] = 'xml:withMessages' Buildr::Findbugs.findbugs(project.findbugs.xml_output_file, project.findbugs.source_paths.flatten.compact, @@ -203,18 +193,22 @@ module Buildr options) end - if project.findbugs.html_enabled? - xml_task = project.task("findbugs:xml") - desc "Generate findbugs html report." - project.task("findbugs:html" => xml_task) do - puts "Findbugs: Generating report" - mkdir_p File.dirname(project.findbugs.html_output_file) - Buildr.ant "findbugs" do |ant| - ant.style :in => project.findbugs.xml_output_file, - :out => project.findbugs.html_output_file, - :style => project.findbugs.style_file - end - end + desc 'Generate findbugs html report.' + project.task('findbugs:html') do + puts 'Findbugs: Analyzing source code...' + options = + { + :properties => project.findbugs.properties, + :fail_on_error => project.findbugs.fail_on_error?, + :extra_dependencies => project.findbugs.extra_dependencies + } + options[:exclude_filter] = project.findbugs.filter_file if File.exist?(project.findbugs.filter_file) + options[:output] = 'html' + + Buildr::Findbugs.findbugs(project.findbugs.html_output_file, + project.findbugs.source_paths.flatten.compact, + project.findbugs.analyze_paths.flatten.compact, + options) end end end
