Repository: buildr
Updated Branches:
  refs/heads/master 599652d09 -> b1e843362


Add jdepend.additional_project_names configuration to jDepend addon to ease 
merging in the source paths from multiple projects into one jDepend task.


Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/b1e84336
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/b1e84336
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/b1e84336

Branch: refs/heads/master
Commit: b1e8433628685db2cea0adecacef2dfdfecffe1f
Parents: 599652d
Author: Peter Donald <[email protected]>
Authored: Tue Mar 1 11:49:22 2016 +1100
Committer: Peter Donald <[email protected]>
Committed: Tue Mar 1 11:49:22 2016 +1100

----------------------------------------------------------------------
 CHANGELOG               |  2 ++
 addon/buildr/jdepend.rb | 42 ++++++++++++++++++++++++++++++------------
 2 files changed, 32 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/b1e84336/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index dac6d5b..2666ed2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 1.4.24 (Pending)
+* Added:  Add jdepend.additional_project_names configuration to jDepend addon 
to
+          ease merging in the source paths from multiple projects into one 
jDepend task.
 * 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

http://git-wip-us.apache.org/repos/asf/buildr/blob/b1e84336/addon/buildr/jdepend.rb
----------------------------------------------------------------------
diff --git a/addon/buildr/jdepend.rb b/addon/buildr/jdepend.rb
index b22761f..bda30a0 100644
--- a/addon/buildr/jdepend.rb
+++ b/addon/buildr/jdepend.rb
@@ -121,6 +121,24 @@ module Buildr
         }
       end
 
+      # An array of additional projects to scan for target_paths
+      attr_writer :additional_project_names
+
+      def additional_project_names
+        @additional_project_names ||= []
+      end
+
+      def complete_target_paths
+        deps = self.target_paths.dup
+
+        self.additional_project_names.each do |project_name|
+          p = self.project.project(project_name)
+          deps << [p.compile.target, p.test.compile.target].flatten.compact
+        end
+
+        deps.flatten.compact
+      end
+
       protected
 
       def initialize(project)
@@ -140,30 +158,30 @@ module Buildr
 
       after_define do |project|
         if project.jdepend.enabled?
-          desc "Generate JDepend xml report."
-          project.task("jdepend:xml") do
-            puts "JDepend: Analyzing source code..."
+          desc 'Generate JDepend xml report.'
+          project.task('jdepend:xml') do
+            puts 'JDepend: Analyzing source code...'
             mkdir_p File.dirname(project.jdepend.xml_output_file)
             Buildr::JDepend.jdepend(project.jdepend.xml_output_file,
-                                    
project.jdepend.target_paths.flatten.compact,
+                                    project.jdepend.complete_target_paths,
                                     project.jdepend.to_options)
           end
 
-          desc "Run JDepend with Swing UI."
-          project.task("jdepend:swing") do
-            puts "JDepend: Analyzing source code..."
+          desc 'Run JDepend with Swing UI.'
+          project.task('jdepend:swing') do
+            puts 'JDepend: Analyzing source code...'
             Buildr::JDepend.jdepend(nil,
-                                    
project.jdepend.target_paths.flatten.compact,
+                                    project.jdepend.complete_target_paths,
                                     project.jdepend.to_options)
           end
 
           if project.jdepend.html_enabled?
-            xml_task = project.task("jdepend:xml")
-            desc "Generate JDepend html report."
+            xml_task = project.task('jdepend:xml')
+            desc 'Generate JDepend html report.'
             project.task("jdepend:html" => xml_task) do
-              puts "JDepend: Generating report"
+              puts 'JDepend: Generating report'
               mkdir_p File.dirname(project.jdepend.html_output_file)
-              Buildr.ant "jdepend" do |ant|
+              Buildr.ant 'jdepend' do |ant|
                 ant.xslt :in => project.jdepend.xml_output_file,
                          :out => project.jdepend.html_output_file,
                          :style => project.jdepend.style_file

Reply via email to