You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2016/03/01 01:02:04 UTC
buildr git commit: Add findbugs.additional_project_names
configuration to Findbugs addon to ease merging in the source paths from
multiple projects into one Findbugs task.
Repository: buildr
Updated Branches:
refs/heads/master 12ccc0f5a -> 599652d09
Add findbugs.additional_project_names configuration to Findbugs addon to ease merging in the source paths from multiple projects into one Findbugs task.
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/599652d0
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/599652d0
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/599652d0
Branch: refs/heads/master
Commit: 599652d09be2fc054301d432047e5b6034002ac9
Parents: 12ccc0f
Author: Peter Donald <pe...@realityforge.org>
Authored: Tue Mar 1 11:01:59 2016 +1100
Committer: Peter Donald <pe...@realityforge.org>
Committed: Tue Mar 1 11:01:59 2016 +1100
----------------------------------------------------------------------
CHANGELOG | 2 ++
addon/buildr/findbugs.rb | 52 ++++++++++++++++++++++++++++++++++++++-----
2 files changed, 48 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/buildr/blob/599652d0/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 76135b1..dac6d5b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
1.4.24 (Pending)
+* Added: Add findbugs.additional_project_names configuration to Findbugs addon to
+ ease merging in the source paths from multiple projects into one Findbugs task.
* Added: Add checkstyle.additional_project_names configuration to Checkstyle addon to
ease merging in the source paths from multiple projects into one Checkstyle task.
* Added: Add pmd.additional_project_names configuration to PMD addon to ease merging in
http://git-wip-us.apache.org/repos/asf/buildr/blob/599652d0/addon/buildr/findbugs.rb
----------------------------------------------------------------------
diff --git a/addon/buildr/findbugs.rb b/addon/buildr/findbugs.rb
index 7712799..4748840 100644
--- a/addon/buildr/findbugs.rb
+++ b/addon/buildr/findbugs.rb
@@ -154,6 +154,46 @@ module Buildr
@extra_dependencies ||= [self.project.compile.dependencies, self.project.test.compile.dependencies].flatten.compact
end
+ # An array of additional projects to scan for main and test sources
+ attr_writer :additional_project_names
+
+ def additional_project_names
+ @additional_project_names ||= []
+ end
+
+ def complete_source_paths
+ paths = self.source_paths.dup
+
+ self.additional_project_names.each do |project_name|
+ p = self.project.project(project_name)
+ paths << [p.compile.sources, p.test.compile.sources].flatten.compact
+ end
+
+ paths.flatten.compact
+ end
+
+ def complete_analyze_paths
+ paths = self.analyze_paths.dup
+
+ self.additional_project_names.each do |project_name|
+ paths << self.project.project(project_name).compile.target
+ end
+
+ paths.flatten.compact
+ end
+
+ def complete_extra_dependencies
+ deps = self.extra_dependencies.dup
+
+ self.additional_project_names.each do |project_name|
+ p = self.project.project(project_name)
+ deps << [p.compile.dependencies, p.test.compile.dependencies].flatten.compact
+ end
+
+ deps.flatten.compact
+ end
+
+
protected
def initialize(project)
@@ -179,15 +219,15 @@ module Buildr
{
:properties => project.findbugs.properties,
:fail_on_error => project.findbugs.fail_on_error?,
- :extra_dependencies => project.findbugs.extra_dependencies
+ :extra_dependencies => project.findbugs.complete_extra_dependencies
}
options[:exclude_filter] = project.findbugs.filter_file if File.exist?(project.findbugs.filter_file)
options[:output] = 'xml:withMessages'
options[:report_level] = project.findbugs.report_level
Buildr::Findbugs.findbugs(project.findbugs.xml_output_file,
- project.findbugs.source_paths.flatten.compact,
- project.findbugs.analyze_paths.flatten.compact,
+ project.findbugs.complete_source_paths,
+ project.findbugs.complete_analyze_paths,
options)
end
@@ -198,15 +238,15 @@ module Buildr
{
:properties => project.findbugs.properties,
:fail_on_error => project.findbugs.fail_on_error?,
- :extra_dependencies => project.findbugs.extra_dependencies
+ :extra_dependencies => project.findbugs.complete_extra_dependencies
}
options[:exclude_filter] = project.findbugs.filter_file if File.exist?(project.findbugs.filter_file)
options[:output] = 'html'
options[:report_level] = project.findbugs.report_level
Buildr::Findbugs.findbugs(project.findbugs.html_output_file,
- project.findbugs.source_paths.flatten.compact,
- project.findbugs.analyze_paths.flatten.compact,
+ project.findbugs.complete_source_paths,
+ project.findbugs.complete_analyze_paths,
options)
end
end