lib/buildr/cobertura.rb in buildr-1.2.3 vs lib/buildr/cobertura.rb in buildr-1.2.4
- old
+ new
@@ -4,11 +4,12 @@
# Require explicitly using <code>require "buildr/cobertura"</code>.
module Cobertura
class << self
- REQUIRES = ["cobertura:cobertura:jar:1.8", "log4j:log4j:jar:1.2.9", "asm:asm:jar:2.2.1", "oro:oro:jar:2.0.8"]
+ REQUIRES = ["net.sourceforge.cobertura:cobertura:jar:1.9", "log4j:log4j:jar:1.2.9",
+ "asm:asm:jar:2.2.1", "asm:asm-tree:jar:2.2.1", "oro:oro:jar:2.0.8"]
def requires()
@requires ||= Buildr.artifacts(REQUIRES).each(&:invoke).map(&:to_s)
end
@@ -39,19 +40,20 @@
touch task.to_s, :verbose=>false
end
# We now have two target directories with bytecode. It would make sense to remove compile.target
# and add instrumented instead, but apparently Cobertura only creates some of the classes, so
# we need both directories and instrumented must come first.
- project.test.classpath.unshift file(instrumented)
+ project.test.classpath.unshift instrumented
project.test.with requires
+ project.test.options[:properties]["net.sourceforge.cobertura.datafile"] = data_file
project.clean { rm_rf instrumented.to_s, :verbose=>false }
end
end
end
desc "Run the test cases and produce code coverage reports in #{report_to(:html)}"
- task "html"=>["instrument", "test:all"] do
+ task "html"=>["instrument", "test"] do
puts "Creating test coverage reports in #{report_to(:html)}"
Buildr.ant "cobertura" do |ant|
ant.taskdef :classpath=>requires.join(File::PATH_SEPARATOR), :resource=>"tasks.properties"
ant.send "cobertura-report", :destdir=>report_to(:html), :format=>"html", :datafile=>data_file do
Buildr.projects.map(&:compile).map(&:sources).flatten.each do |src|
@@ -60,10 +62,10 @@
end
end
end
desc "Run the test cases and produce code coverage reports in #{report_to(:xml)}"
- task "xml"=>["instrument", "test:all"] do
+ task "xml"=>["instrument", "test"] do
puts "Creating test coverage reports in #{report_to(:xml)}"
Buildr.ant "cobertura" do |ant|
ant.taskdef :classpath=>requires.join(File::PATH_SEPARATOR), :resource=>"tasks.properties"
ant.send "cobertura-report", :destdir=>report_to(:xml), :format=>"xml", :datafile=>data_file do
Buildr.projects.map(&:compile).map(&:sources).flatten.each do |src|