Add pmd.additional_project_names configuration to PMD addon to ease merging in the source paths from multiple projects into one PMD task.
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/7fd0445c Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/7fd0445c Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/7fd0445c Branch: refs/heads/master Commit: 7fd0445cbeb0a6e3108984959335a074afb06079 Parents: 2626744 Author: Peter Donald <[email protected]> Authored: Tue Mar 1 09:16:42 2016 +1100 Committer: Peter Donald <[email protected]> Committed: Tue Mar 1 09:16:42 2016 +1100 ---------------------------------------------------------------------- CHANGELOG | 2 ++ addon/buildr/pmd.rb | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/buildr/blob/7fd0445c/CHANGELOG ---------------------------------------------------------------------- diff --git a/CHANGELOG b/CHANGELOG index 4a734b0..6c9ba3e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,6 @@ 1.4.24 (Pending) +* Added: Add pmd.additional_project_names configuration to PMD addon to ease merging in + the source paths from multiple projects into one PMD task. * Fixed: In the PMD addon, check that the source directory exists before adding to sources directories to include. * Fixed: BUILDR-709 - Fix "Exception in jacoco.rb [TypeError : can't convert Array into http://git-wip-us.apache.org/repos/asf/buildr/blob/7fd0445c/addon/buildr/pmd.rb ---------------------------------------------------------------------- diff --git a/addon/buildr/pmd.rb b/addon/buildr/pmd.rb index 94f7a89..7d08144 100644 --- a/addon/buildr/pmd.rb +++ b/addon/buildr/pmd.rb @@ -125,8 +125,22 @@ module Buildr @source_paths ||= [self.project.compile.sources, self.project.test.compile.sources].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 flat_source_paths - source_paths.flatten.compact + paths = 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 protected
