buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject git commit: Add the ability to generate a html report when using the jacoco addon. Extracted from the ode project.
Date Thu, 24 Apr 2014 23:47:13 GMT
Repository: buildr
Updated Branches:
  refs/heads/master 9ad194a7d -> eca6aeb49


Add the ability to generate a html report when using the jacoco addon. Extracted from the
ode project.


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

Branch: refs/heads/master
Commit: eca6aeb49f928a7e841c26c2def6b1813a573b43
Parents: 9ad194a
Author: Peter Donald <peter@realityforge.org>
Authored: Fri Apr 25 09:47:01 2014 +1000
Committer: Peter Donald <peter@realityforge.org>
Committed: Fri Apr 25 09:47:01 2014 +1000

----------------------------------------------------------------------
 CHANGELOG              |  2 ++
 addon/buildr/jacoco.rb | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/eca6aeb4/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index e136b95..428e7f3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 1.4.16 (Pending)
+* Added:  Add the ability to generate a html report when using the
+          jacoco addon. Extracted from the ode project.
 * Fixed:  Remove the projectname.ids file when rebuilding the idea
           project file avoiding conflict with idea.
 * Fixed:  Avoid passing duplicate -keep parameters to wsimport from

http://git-wip-us.apache.org/repos/asf/buildr/blob/eca6aeb4/addon/buildr/jacoco.rb
----------------------------------------------------------------------
diff --git a/addon/buildr/jacoco.rb b/addon/buildr/jacoco.rb
index e863ce1..a7055ed 100644
--- a/addon/buildr/jacoco.rb
+++ b/addon/buildr/jacoco.rb
@@ -185,6 +185,40 @@ module Buildr
           end
         end
       end
+      namespace 'jacoco' do
+        desc "Generate JaCoCo reports."
+        task 'report' do
+          Buildr.ant "jacoco" do |ant|
+            ant.taskdef(:resource => "org/jacoco/ant/antlib.xml") do |ant|
+              ant.classpath :path => Buildr.artifacts(Buildr::JaCoCo.ant_spec).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
+            end
+            ant.report do |ant|
+              ant.executiondata do |ant|
+                Buildr.projects.each do |project|
+                  ant.fileset :file=>project.jacoco.destfile if File.exist?(project.jacoco.destfile)
+                end
+              end
+
+              ant.structure(:name => "Jacoco Report") do |ant|
+                ant.classfiles do |ant|
+                  Buildr.projects.map(&:compile).map(&:target).flatten.map(&:to_s).each
do |src|
+                    ant.fileset :dir=>src.to_s if File.exist?(src)
+                  end
+                end
+                ant.sourcefiles(:encoding => "UTF-8") do |ant|
+                  Buildr.projects.map(&:compile).map(&:sources).flatten.map(&:to_s).each
do |src|
+                    ant.fileset :dir=>src.to_s if File.exist?(src)
+                  end
+                end
+              end
+
+              ant.html :destdir => "reports/jacoco"
+              ant.xml :destfile => "reports/jacoco/jacoco.xml"
+              ant.csv :destfile => "reports/jacoco/jacoco.csv"
+            end
+          end
+        end
+      end
     end
   end
 end


Mime
View raw message