buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djspie...@apache.org
Subject svn commit: r783151 - /buildr/trunk/lib/buildr/java/cobertura.rb
Date Tue, 09 Jun 2009 22:08:26 GMT
Author: djspiewak
Date: Tue Jun  9 22:08:26 2009
New Revision: 783151

URL: http://svn.apache.org/viewvc?rev=783151&view=rev
Log:
Do not define instrumentation tasks for projects without sources

Modified:
    buildr/trunk/lib/buildr/java/cobertura.rb

Modified: buildr/trunk/lib/buildr/java/cobertura.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/cobertura.rb?rev=783151&r1=783150&r2=783151&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/cobertura.rb (original)
+++ buildr/trunk/lib/buildr/java/cobertura.rb Tue Jun  9 22:08:26 2009
@@ -181,16 +181,18 @@
             project.test.with Cobertura.dependencies
             project.test.options[:properties]["net.sourceforge.cobertura.datafile"] = cobertura.data_file
             
-            [:xml, :html].each do |format|
-              task format => ['instrument', 'test'] do 
-                info "Creating test coverage reports in #{cobertura.report_to(format)}"
-                Buildr.ant "cobertura" do |ant|
-                  ant.taskdef :resource=>"tasks.properties",
-                    :classpath=>Buildr.artifacts(Cobertura.dependencies).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
-                  ant.send "cobertura-report", :format=>format, 
-                    :destdir=>cobertura.report_to(format), :datafile=>cobertura.data_file
do
-                    cobertura.sources.flatten.each do |src|
-                      ant.fileset(:dir=>src.to_s) if File.exist?(src.to_s)
+            unless project.compile.sources.empty?
+              [:xml, :html].each do |format|
+                task format => ['instrument', 'test'] do 
+                  info "Creating test coverage reports in #{cobertura.report_to(format)}"
+                  Buildr.ant "cobertura" do |ant|
+                    ant.taskdef :resource=>"tasks.properties",
+                      :classpath=>Buildr.artifacts(Cobertura.dependencies).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
+                    ant.send "cobertura-report", :format=>format, 
+                      :destdir=>cobertura.report_to(format), :datafile=>cobertura.data_file
do
+                      cobertura.sources.flatten.each do |src|
+                        ant.fileset(:dir=>src.to_s) if File.exist?(src.to_s)
+                      end
                     end
                   end
                 end



Mime
View raw message