You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by to...@apache.org on 2010/08/24 07:05:16 UTC
svn commit: r988389 - in /buildr/trunk: CHANGELOG
lib/buildr/java/cobertura.rb spec/java/cobertura_spec.rb
Author: toulmean
Date: Tue Aug 24 05:05:16 2010
New Revision: 988389
URL: http://svn.apache.org/viewvc?rev=988389&view=rev
Log:
BUILDR-285 Cobertura failing when running build
Modified:
buildr/trunk/CHANGELOG
buildr/trunk/lib/buildr/java/cobertura.rb
buildr/trunk/spec/java/cobertura_spec.rb
Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=988389&r1=988388&r2=988389&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Tue Aug 24 05:05:16 2010
@@ -11,6 +11,7 @@
* Fixed: BUILDR-203 Compiler guessing very inefficient
* Fixed: BUILDR-225 ArchiveTask#merge, not according to doc
* Fixed: BUILDR-256 Automatically installing gems aborts rspec test runner (Rhett Sutphin)
+* Fixed: BUILDR-285 Cobertura failing when running build
* Fixed: BUILDR-302 Move out-of-date Nailgun documentation to wiki (Shane Witbeck)
* Fixed: BUILDR-317 ecj compiler
* Fixed: BUILDR-326 follow up: binary safe untarring on Windows (Sam Hendley)
Modified: buildr/trunk/lib/buildr/java/cobertura.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/cobertura.rb?rev=988389&r1=988388&r2=988389&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/cobertura.rb (original)
+++ buildr/trunk/lib/buildr/java/cobertura.rb Tue Aug 24 05:05:16 2010
@@ -269,13 +269,15 @@ module Buildr
report_target = report_to(format)
desc "Run the test cases and produce code coverage reports in #{report_target}"
task format => ["instrument", "test"] do
- info "Creating test coverage reports in #{report_target}"
- 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", :destdir=>report_target, :format=>format, :datafile=>data_file do
- Buildr.projects.map(&:cobertura).map(&:sources).flatten.each do |src|
- ant.fileset :dir=>src.to_s if File.exist?(src.to_s)
+ if Buildr.projects.detect { |project| !project.compile.sources.empty? }
+ info "Creating test coverage reports in #{report_target}"
+ 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", :destdir=>report_target, :format=>format, :datafile=>data_file do
+ Buildr.projects.map(&:cobertura).map(&:sources).flatten.each do |src|
+ ant.fileset :dir=>src.to_s if File.exist?(src.to_s)
+ end
end
end
end
Modified: buildr/trunk/spec/java/cobertura_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/cobertura_spec.rb?rev=988389&r1=988388&r2=988389&view=diff
==============================================================================
--- buildr/trunk/spec/java/cobertura_spec.rb (original)
+++ buildr/trunk/spec/java/cobertura_spec.rb Tue Aug 24 05:05:16 2010
@@ -53,6 +53,11 @@ describe Buildr::Cobertura do
define('foo') { define('bar') }
task('foo:bar:cobertura:instrument').invoke
end
+
+ it 'should not generate html if projects have no sources' do
+ define('foo') { define('bar') }
+ task('cobertura:html').invoke
+ end
end
describe 'instrumentation' do