You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by la...@apache.org on 2008/10/01 19:14:24 UTC
svn commit: r700843 - in /incubator/buildr/trunk: addon/buildr/cobertura.rb
addon/buildr/emma.rb spec/addon/test_coverage_spec.rb
Author: lacton
Date: Wed Oct 1 10:14:24 2008
New Revision: 700843
URL: http://svn.apache.org/viewvc?rev=700843&view=rev
Log:
cobertura:html and emma:html should handle gracefully a subproject with no sources
Modified:
incubator/buildr/trunk/addon/buildr/cobertura.rb
incubator/buildr/trunk/addon/buildr/emma.rb
incubator/buildr/trunk/spec/addon/test_coverage_spec.rb
Modified: incubator/buildr/trunk/addon/buildr/cobertura.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/addon/buildr/cobertura.rb?rev=700843&r1=700842&r2=700843&view=diff
==============================================================================
--- incubator/buildr/trunk/addon/buildr/cobertura.rb (original)
+++ incubator/buildr/trunk/addon/buildr/cobertura.rb Wed Oct 1 10:14:24 2008
@@ -202,7 +202,8 @@
Buildr.projects.each do |project|
project.cobertura.data_file = data_file
project.test.options[:properties]["net.sourceforge.cobertura.datafile"] = data_file
- project.task('cobertura:instrument').invoke
+ instrument_task ="#{project.name}:cobertura:instrument"
+ task(instrument_task).invoke if Rake::Task.task_defined?(instrument_task)
end
end
Modified: incubator/buildr/trunk/addon/buildr/emma.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/addon/buildr/emma.rb?rev=700843&r1=700842&r2=700843&view=diff
==============================================================================
--- incubator/buildr/trunk/addon/buildr/emma.rb (original)
+++ incubator/buildr/trunk/addon/buildr/emma.rb Wed Oct 1 10:14:24 2008
@@ -207,8 +207,9 @@
Emma.ant do |ant|
ant.merge :outfile=>data_file do
Buildr.projects.each do |project|
- ant.fileset :file=>project.emma.metadata_file
- ant.fileset :file=>project.emma.coverage_file
+ [project.emma.metadata_file, project.emma.coverage_file].each do |data_file|
+ ant.fileset :file=>data_file if File.exist?(data_file)
+ end
end
end
ant.report do
Modified: incubator/buildr/trunk/spec/addon/test_coverage_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/addon/test_coverage_spec.rb?rev=700843&r1=700842&r2=700843&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/addon/test_coverage_spec.rb (original)
+++ incubator/buildr/trunk/spec/addon/test_coverage_spec.rb Wed Oct 1 10:14:24 2008
@@ -178,7 +178,7 @@
write 'src/main/java/Foo.java', 'public class Foo {}'
write 'bar/src/main/java/Bar.java', 'public class Bar {}'
write_test :for=>'Bar', :in=>'bar/src/test/java'
- define('foo') { define('bar')}
+ define('foo') { define('bar') }
end
it 'should have a default target' do
@@ -206,6 +206,12 @@
htlm_report_contents = Dir[File.join(@tool_module.report_to(:html), '**/*.html')].map{|path|File.open(path).read}.join
htlm_report_contents.should =~ /TOKEN/
end
+
+ it 'should handle gracefully a project with no source' do
+ define 'baz', :base_dir=>'baz'
+ task("#{toolname}:html").invoke
+ lambda { task("#{toolname}:html").invoke }.should_not raise_error
+ end
end
end