buildr 1.4.1-x86-mswin32 → 1.4.2-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/CHANGELOG +68 -11
  2. data/_buildr +2 -0
  3. data/addon/buildr/hibernate.rb +8 -5
  4. data/addon/buildr/jetty.rb +1 -1
  5. data/addon/buildr/openjpa.rb +0 -2
  6. data/addon/buildr/xmlbeans.rb +1 -1
  7. data/buildr.gemspec +13 -9
  8. data/doc/_layouts/default.html +3 -1
  9. data/doc/contributing.textile +10 -2
  10. data/doc/css/default.css +6 -6
  11. data/doc/download.textile +7 -7
  12. data/doc/languages.textile +2 -2
  13. data/doc/more_stuff.textile +41 -33
  14. data/doc/packaging.textile +6 -3
  15. data/doc/releasing.textile +116 -0
  16. data/doc/scripts/install-linux.sh +7 -6
  17. data/doc/testing.textile +14 -0
  18. data/lib/buildr.rb +2 -2
  19. data/lib/buildr/core.rb +0 -6
  20. data/lib/buildr/core/application.rb +25 -2
  21. data/lib/buildr/core/build.rb +66 -15
  22. data/lib/buildr/core/compile.rb +10 -1
  23. data/lib/buildr/core/filter.rb +1 -1
  24. data/lib/buildr/core/progressbar.rb +8 -3
  25. data/lib/buildr/core/test.rb +57 -6
  26. data/lib/buildr/core/transports.rb +18 -13
  27. data/lib/buildr/core/util.rb +19 -3
  28. data/lib/buildr/groovy/compiler.rb +2 -2
  29. data/lib/buildr/ide/eclipse.rb +32 -12
  30. data/lib/buildr/java/ant.rb +3 -3
  31. data/lib/buildr/java/bdd.rb +1 -2
  32. data/lib/buildr/java/cobertura.rb +10 -9
  33. data/lib/buildr/java/commands.rb +22 -21
  34. data/lib/buildr/java/compiler.rb +2 -2
  35. data/lib/buildr/java/doc.rb +1 -1
  36. data/lib/buildr/java/ecj.rb +71 -0
  37. data/lib/buildr/java/emma.rb +1 -1
  38. data/lib/buildr/java/external.rb +9 -9
  39. data/lib/buildr/java/jruby.rb +5 -0
  40. data/lib/buildr/java/packaging.rb +4 -3
  41. data/lib/buildr/java/rjb.rb +4 -6
  42. data/lib/buildr/java/tests.rb +9 -4
  43. data/lib/buildr/packaging/archive.rb +7 -3
  44. data/lib/buildr/packaging/artifact.rb +153 -38
  45. data/lib/buildr/packaging/gems.rb +2 -3
  46. data/lib/buildr/packaging/package.rb +19 -12
  47. data/lib/buildr/packaging/tar.rb +1 -1
  48. data/lib/buildr/packaging/ziptask.rb +1 -1
  49. data/lib/buildr/scala/bdd.rb +7 -3
  50. data/lib/buildr/scala/compiler.rb +2 -2
  51. data/lib/buildr/scala/doc.rb +3 -3
  52. data/lib/buildr/scala/tests.rb +7 -3
  53. data/lib/buildr/version.rb +18 -0
  54. data/rakelib/all-in-one.rake +1 -1
  55. data/rakelib/doc.rake +13 -3
  56. data/rakelib/metrics.rake +39 -0
  57. data/spec/core/application_spec.rb +13 -12
  58. data/spec/core/build_spec.rb +166 -7
  59. data/spec/core/cc_spec.rb +1 -1
  60. data/spec/core/checks_spec.rb +1 -1
  61. data/spec/core/common_spec.rb +10 -1
  62. data/spec/core/compile_spec.rb +1 -1
  63. data/spec/core/extension_spec.rb +1 -1
  64. data/spec/core/generate_spec.rb +1 -1
  65. data/spec/core/project_spec.rb +1 -1
  66. data/spec/core/test_spec.rb +124 -11
  67. data/spec/core/transport_spec.rb +10 -3
  68. data/spec/core/util_spec.rb +18 -2
  69. data/spec/groovy/bdd_spec.rb +1 -1
  70. data/spec/groovy/compiler_spec.rb +3 -3
  71. data/spec/ide/eclipse_spec.rb +63 -1
  72. data/spec/ide/idea7x_spec.rb +1 -1
  73. data/spec/java/ant_spec.rb +1 -1
  74. data/spec/java/bdd_spec.rb +1 -1
  75. data/spec/java/cobertura_spec.rb +29 -2
  76. data/spec/java/commands_spec.rb +61 -2
  77. data/spec/java/compiler_spec.rb +3 -3
  78. data/spec/java/ecj_spec.rb +115 -0
  79. data/spec/java/emma_spec.rb +1 -1
  80. data/spec/java/external_spec.rb +10 -8
  81. data/spec/java/java_spec.rb +14 -6
  82. data/spec/java/packaging_spec.rb +41 -15
  83. data/spec/java/test_coverage_helper.rb +1 -1
  84. data/spec/java/tests_spec.rb +1 -1
  85. data/spec/packaging/archive_spec.rb +12 -1
  86. data/spec/packaging/artifact_namespace_spec.rb +1 -1
  87. data/spec/packaging/artifact_spec.rb +197 -7
  88. data/spec/packaging/packaging_spec.rb +12 -12
  89. data/spec/sandbox.rb +8 -3
  90. data/spec/scala/bdd_spec.rb +3 -3
  91. data/spec/scala/compiler_spec.rb +7 -7
  92. data/spec/scala/scala.rb +3 -3
  93. data/spec/scala/tests_spec.rb +3 -3
  94. data/spec/spec_helpers.rb +11 -1
  95. data/spec/version_requirement_spec.rb +1 -1
  96. metadata +220 -85
  97. data/rakelib/jekylltask.rb +0 -120
@@ -188,9 +188,9 @@ module Buildr
188
188
  File.open(dest, 'wb') { |file| file.write mapped }
189
189
  else # no mapping
190
190
  cp source, dest
191
- File.chmod(0664, dest)
192
191
  end
193
192
  end
193
+ File.chmod(File.stat(source).mode | 0200, dest)
194
194
  end
195
195
  touch target.to_s
196
196
  true
@@ -23,7 +23,7 @@ class ProgressBar
23
23
  end
24
24
 
25
25
  def width
26
- @width ||= $terminal.output_cols || 80
26
+ @width ||= $terminal.output_cols || 0
27
27
  end
28
28
 
29
29
  end
@@ -66,6 +66,7 @@ class ProgressBar
66
66
  end
67
67
 
68
68
  def title
69
+ return @title if ProgressBar.width <= 10
69
70
  @title.size > ProgressBar.width / 5 ? (@title[0, ProgressBar.width / 5 - 2] + '..') : @title
70
71
  end
71
72
 
@@ -126,7 +127,7 @@ class ProgressBar
126
127
  protected
127
128
 
128
129
  def clear
129
- return unless @output
130
+ return if @output == nil || ProgressBar.width <= 0
130
131
  @output.print "\r", " " * (ProgressBar.width - 1), "\r"
131
132
  @output.flush
132
133
  end
@@ -135,7 +136,11 @@ protected
135
136
  return unless @output
136
137
  format, *args = @format
137
138
  line = format % args.map { |arg| send(arg) }
138
- @output.print line.sub('|--|') { progress(ProgressBar.width - line.size + 3) }
139
+ if ProgressBar.width >= line.size
140
+ @output.print line.sub('|--|') { progress(ProgressBar.width - line.size + 3) }
141
+ else
142
+ @output.print line.sub('|--|', '')
143
+ end
139
144
  @output.print @finished ? "\n" : "\r"
140
145
  @output.flush
141
146
  @previous = @count
@@ -171,7 +171,7 @@ module Buildr
171
171
 
172
172
  # Used by the test/integration rule to only run tests that match the specified names.
173
173
  def only_run(tests) #:nodoc:
174
- tests = tests.map { |name| name =~ /\*/ ? name : "*#{name}*" }
174
+ tests = wildcardify(tests)
175
175
  # Since the tests may reside in a sub-project, we need to set the include/exclude pattern on
176
176
  # all sub-projects, but only invoke test on the local project.
177
177
  Project.projects.each { |project| project.test.send :only_run, tests }
@@ -183,6 +183,37 @@ module Buildr
183
183
  # all sub-projects, but only invoke test on the local project.
184
184
  Project.projects.each { |project| project.test.send :only_run_failed }
185
185
  end
186
+
187
+ # Used by the test/integration rule to clear all previously included/excluded tests.
188
+ def clear()
189
+ Project.projects.each do |project|
190
+ project.test.send :clear
191
+ end
192
+ end
193
+
194
+ # Used by the test/integration to include specific tests
195
+ def include(includes)
196
+ Project.projects.each do |project|
197
+ includes = wildcardify(includes)
198
+ project.test.send :include, *includes if includes.size > 0
199
+ project.test.send :forced_need=, true
200
+ end
201
+ end
202
+
203
+ # Used by the test/integration to exclude specific tests
204
+ def exclude(excludes)
205
+ Project.projects.each do |project|
206
+ excludes = wildcardify(excludes)
207
+ project.test.send :exclude, *excludes if excludes.size > 0
208
+ project.test.send :forced_need=, true
209
+ end
210
+ end
211
+
212
+ private
213
+
214
+ def wildcardify(strings)
215
+ strings.map { |name| name =~ /\*/ ? name : "*#{name}*" }
216
+ end
186
217
  end
187
218
 
188
219
  # Default options already set on each test task.
@@ -367,6 +398,13 @@ module Buildr
367
398
  self
368
399
  end
369
400
 
401
+ # Clear all test includes and excludes and returns self
402
+ def clear
403
+ @include = []
404
+ @exclude = []
405
+ self
406
+ end
407
+
370
408
  # *Deprecated*: Use tests instead.
371
409
  def classes
372
410
  Buildr.application.deprecated 'Call tests instead of classes'
@@ -423,7 +461,7 @@ module Buildr
423
461
  # We read the last test failures if any and return them.
424
462
  #
425
463
  def last_failures
426
- @last_failures ||= failures_to.exist? ? File.read(failures_to.to_s).split('\n') : []
464
+ @last_failures ||= failures_to.exist? ? File.read(failures_to.to_s).split("\n") : []
427
465
  end
428
466
 
429
467
  # The path to the file that stores the time stamp of the last successful test run.
@@ -439,6 +477,9 @@ module Buildr
439
477
  # The project this task belongs to.
440
478
  attr_reader :project
441
479
 
480
+ # Whether the tests are forced
481
+ attr_accessor :forced_need
482
+
442
483
  protected
443
484
 
444
485
  def associate_with(project)
@@ -460,7 +501,7 @@ module Buildr
460
501
  # Returns true if the specified test name matches the inclusion/exclusion pattern. Used to determine
461
502
  # which tests to execute.
462
503
  def include?(name)
463
- (@include.empty? || @include.any? { |pattern| File.fnmatch(pattern, name) }) &&
504
+ ((@include.empty? && !@forced_need)|| @include.any? { |pattern| File.fnmatch(pattern, name) }) &&
464
505
  !@exclude.any? { |pattern| File.fnmatch(pattern, name) }
465
506
  end
466
507
 
@@ -480,7 +521,7 @@ module Buildr
480
521
  @passed_tests = @framework.run(@tests, dependencies)
481
522
  rescue Exception=>ex
482
523
  error "Test framework error: #{ex.message}"
483
- error ex.backtrace.join("\n") if Buildr.application.options.trace
524
+ error ex.backtrace.join("\n") if trace?
484
525
  @passed_tests = []
485
526
  end
486
527
  @failed_tests = @tests - @passed_tests
@@ -509,7 +550,6 @@ module Buildr
509
550
  # Limit running tests to those who failed the last time.
510
551
  def only_run_failed()
511
552
  @include = Array(last_failures)
512
- @exclude.clear
513
553
  @forced_need = true
514
554
  end
515
555
 
@@ -597,7 +637,18 @@ module Buildr
597
637
  # (* and ?) patterns to match multiple tests, see the TestTask#include method.
598
638
  rule /^test:.*$/ do |task|
599
639
  # The map works around a JRuby bug whereby the string looks fine, but fails in fnmatch.
600
- TestTask.only_run task.name.scan(/test:(.*)/)[0][0].split(',').map { |t| "#{t}" }
640
+ tests = task.name.scan(/test:(.*)/)[0][0].split(',').map(&:to_s)
641
+ excludes, includes = tests.partition { |t| t =~ /^-/ }
642
+ if excludes.empty?
643
+ TestTask.only_run includes
644
+ else
645
+ # remove leading '-'
646
+ excludes.map! { |t| t[1..-1] }
647
+
648
+ TestTask.clear
649
+ TestTask.include(includes.empty? ? '*' : includes)
650
+ TestTask.exclude excludes
651
+ end
601
652
  task('test').invoke
602
653
  end
603
654
 
@@ -396,25 +396,23 @@ module URI
396
396
  ssh_options[:password] ||= SFTP.passwords[host]
397
397
  begin
398
398
  trace "Connecting to #{host}"
399
- result = nil
399
+ if block
400
+ result = nil
401
+ else
402
+ result = ''
403
+ block = lambda { |chunk| result << chunk }
404
+ end
400
405
  Net::SFTP.start(host, user, ssh_options) do |sftp|
401
406
  SFTP.passwords[host] = ssh_options[:password]
402
407
  trace 'connected'
403
408
 
404
409
  with_progress_bar options[:progress] && options[:size], path.split('/'), options[:size] || 0 do |progress|
405
- trace "Downloading to #{path}"
410
+ trace "Downloading from #{path}"
406
411
  sftp.file.open(path, 'r') do |file|
407
- if block
408
- while chunk = file.read(RW_CHUNK_SIZE)
409
- block.call chunk
410
- progress << chunk
411
- end
412
- else
413
- result = ''
414
- while chunk = file.read(RW_CHUNK_SIZE)
415
- result << chunk
416
- progress << chunk
417
- end
412
+ while chunk = file.read(RW_CHUNK_SIZE)
413
+ block.call chunk
414
+ progress << chunk
415
+ break if chunk.size < RW_CHUNK_SIZE
418
416
  end
419
417
  end
420
418
  end
@@ -486,6 +484,13 @@ module URI
486
484
 
487
485
  COMPONENT = [ :host, :path ].freeze
488
486
 
487
+ def upload(source, options = nil)
488
+ super
489
+ if File === source then
490
+ File.chmod(source.stat.mode, real_path)
491
+ end
492
+ end
493
+
489
494
  def initialize(*args)
490
495
  super
491
496
  # file:something (opaque) becomes file:///something
@@ -54,7 +54,7 @@ module Buildr
54
54
  def ruby(*args)
55
55
  options = Hash === args.last ? args.pop : {}
56
56
  cmd = []
57
- ruby_bin = File.expand_path(Config::CONFIG['ruby_install_name'], Config::CONFIG['bindir'])
57
+ ruby_bin = File.normalize_path(Config::CONFIG['ruby_install_name'], Config::CONFIG['bindir'])
58
58
  if options.delete(:sudo) && !(win_os? || Process.uid == File.stat(ruby_bin).uid)
59
59
  cmd << 'sudo' << '-u' << "##{File.stat(ruby_bin).uid}"
60
60
  end
@@ -115,6 +115,22 @@ module Buildr
115
115
  FileList[dirs.map { |dir| File.join(dir, '/**/{*,.*}') }].reject { |file| File.basename(file) =~ /^[.]{1,2}$/ }
116
116
  end
117
117
 
118
+ # :call-seq:
119
+ # replace_extension(filename) => filename_with_updated_extension
120
+ #
121
+ # Replace the file extension, e.g.,
122
+ # replace_extension("foo.zip", "txt") => "foo.txt"
123
+ def replace_extension(filename, new_ext)
124
+ ext = File.extname(filename)
125
+ if filename =~ /\.$/
126
+ filename + new_ext
127
+ elsif ext == ""
128
+ filename + "." + new_ext
129
+ else
130
+ filename[0..-ext.length] + new_ext
131
+ end
132
+ end
133
+
118
134
  # Utility methods for running gem commands
119
135
  module Gems #:nodoc:
120
136
  extend self
@@ -126,8 +142,8 @@ module Buildr
126
142
  # is not running interactively (on a tty)
127
143
  def install(*dependencies)
128
144
  raise ArgumentError, "Expected at least one argument" if dependencies.empty?
129
- remote = dependencies.map { |dep| Gem::SourceInfoCache.search(dep).last || dep }
130
- not_found_deps, to_install = remote.partition { |gem| gem.is_a?(Gem::Dependency) }
145
+ remote = dependencies.map{ |dep| Gem.source_index.search(dep).last || Gem::SpecFetcher.fetcher.fetch( dep, true ).map{ |spec, source| spec }.last }
146
+ not_found_deps, to_install = remote.partition { |gem| gem.is_a?(Gem::Dependency) || gem.nil? }
131
147
  fail Gem::LoadError, "Build requires the gems #{not_found_deps.join(', ')}, which cannot be found in local or remote repository." unless not_found_deps.empty?
132
148
  uses = "This build requires the gems #{to_install.map(&:full_name).join(', ')}:"
133
149
  fail Gem::LoadError, "#{uses} to install, run Buildr interactively." unless $stdout.isatty
@@ -53,7 +53,7 @@ module Buildr::Groovy
53
53
  # The groovyc compiler jars are added to classpath at load time,
54
54
  # if you want to customize artifact versions, you must set them on the
55
55
  #
56
- # artifact_ns['Buildr::Compiler::Groovyc'].groovy = '1.7.1'
56
+ # artifact_ns(Buildr::Groovy::Groovyc).groovy = '1.7.1'
57
57
  #
58
58
  # namespace before this file is required.
59
59
  REQUIRES = ArtifactNamespace.for(self) do |ns|
@@ -95,7 +95,7 @@ module Buildr::Groovy
95
95
  options[:debug] = Buildr.options.debug if options[:debug].nil?
96
96
  options[:deprecation] ||= false
97
97
  options[:optimise] ||= false
98
- options[:verbose] ||= Buildr.application.options.trace if options[:verbose].nil?
98
+ options[:verbose] ||= trace?(:groovyc) if options[:verbose].nil?
99
99
  options[:warnings] = verbose if options[:warnings].nil?
100
100
  options[:javac] = OpenObject.new if options[:javac].nil?
101
101
  end
@@ -25,14 +25,21 @@ module Buildr
25
25
  class Eclipse
26
26
 
27
27
  attr_reader :options
28
+ attr_writer :name
28
29
 
29
30
  def initialize(project)
30
31
  @project = project
31
32
  @options = Options.new(project)
32
33
  end
33
34
 
35
+ def name
36
+ return @name if @name
37
+ return @project.id.split('-').last if @options.short_names
38
+ @project.id
39
+ end
40
+
34
41
  # :call-seq:
35
- # classpath_variables { :VAR => '/path/to/location' }
42
+ # classpath_variables :VAR => '/path/to/location'
36
43
  # Sets classpath variables to be used for library path substitution
37
44
  # on the project.
38
45
  #
@@ -156,7 +163,7 @@ module Buildr
156
163
 
157
164
  class Options
158
165
 
159
- attr_writer :m2_repo_var
166
+ attr_writer :m2_repo_var, :short_names
160
167
 
161
168
  def initialize(project)
162
169
  @project = project
@@ -173,6 +180,10 @@ module Buildr
173
180
  @m2_repo_var || (@project.parent ? @project.parent.eclipse.options.m2_repo_var : 'M2_REPO')
174
181
  end
175
182
  end
183
+
184
+ def short_names
185
+ @short_names || (@project.parent ? @project.parent.eclipse.options.short_names : false)
186
+ end
176
187
  end
177
188
 
178
189
  def eclipse
@@ -265,7 +276,7 @@ module Buildr
265
276
  File.open(task.name, 'w') do |file|
266
277
  xml = Builder::XmlMarkup.new(:target=>file, :indent=>2)
267
278
  xml.projectDescription do
268
- xml.name project.id
279
+ xml.name project.eclipse.name
269
280
  xml.projects
270
281
  unless project.eclipse.builders.empty?
271
282
  xml.buildSpec do
@@ -330,8 +341,8 @@ module Buildr
330
341
  # Write a classpathentry of kind 'src' for dependent projects.
331
342
  # Accept an array of projects.
332
343
  def src_projects project_libs
333
- project_libs.map(&:id).sort.uniq.each do |project_id|
334
- @xml.classpathentry :kind=>'src', :combineaccessrules=>'false', :path=>"/#{project_id}"
344
+ project_libs.map { |project| project.eclipse.name }.sort.uniq.each do |eclipse_name|
345
+ @xml.classpathentry :kind=>'src', :combineaccessrules=>'false', :path=>"/#{eclipse_name}"
335
346
  end
336
347
  end
337
348
 
@@ -347,18 +358,27 @@ module Buildr
347
358
  def var(libs)
348
359
  libs.each do |lib_path, var_name, var_value|
349
360
  lib_artifact = file(lib_path)
350
- relative_lib_path = lib_path.sub(var_value, var_name.to_s)
361
+
362
+ attribs = { :kind => 'var', :path => lib_path }
363
+
351
364
  if lib_artifact.respond_to? :sources_artifact
352
- source_path = lib_artifact.sources_artifact.to_s
353
- relative_source_path = source_path.sub(var_value, var_name)
354
- @xml.classpathentry :kind=>'var', :path=>relative_lib_path, :sourcepath=>relative_source_path
355
- else
356
- @xml.classpathentry :kind=>'var', :path=>relative_lib_path
365
+ attribs[:sourcepath] = lib_artifact.sources_artifact
357
366
  end
367
+
368
+ if lib_artifact.respond_to? :javadoc_artifact
369
+ attribs[:javadocpath] = lib_artifact.javadoc_artifact
370
+ end
371
+
372
+ # make all paths relative
373
+ attribs.each_key do |k|
374
+ attribs[k] = attribs[k].to_s.sub(var_value, var_name.to_s) if k.to_s =~ /path/
375
+ end
376
+
377
+ @xml.classpathentry attribs
358
378
  end
359
379
  end
360
380
 
361
- private
381
+ private
362
382
 
363
383
  # Find a path relative to the project's root directory if possible. If the
364
384
  # two paths do not share the same root the absolute path is returned. This
@@ -14,7 +14,7 @@
14
14
  # the License.
15
15
 
16
16
 
17
- gem 'Antwrap'
17
+ gem 'atoulme-Antwrap'
18
18
  autoload :Antwrap, 'antwrap'
19
19
  autoload :Logger, 'logger'
20
20
  require 'buildr/core/project'
@@ -69,12 +69,12 @@ module Buildr
69
69
  # end
70
70
  def ant(name, &block)
71
71
  options = { :name=>name, :basedir=>Dir.pwd, :declarative=>true }
72
- options.merge!(:logger=> Logger.new(STDOUT), :loglevel=> Logger::DEBUG) if Buildr.application.options.trace
72
+ options.merge!(:logger=> Logger.new(STDOUT), :loglevel=> Logger::DEBUG) if trace?(:ant)
73
73
  Java.load
74
74
  Antwrap::AntProject.new(options).tap do |project|
75
75
  # Set Ant logging level to debug (--trace), info (default) or error only (--quiet).
76
76
  project.project.getBuildListeners().get(0).
77
- setMessageOutputLevel((Buildr.application.options.trace && 4) || (verbose && 2) || 0)
77
+ setMessageOutputLevel((trace?(:ant) && 4) || (verbose && 2) || 0)
78
78
  yield project if block_given?
79
79
  end
80
80
  end
@@ -48,7 +48,7 @@ module Buildr
48
48
  module TestFramework::JRubyBased
49
49
  extend self
50
50
 
51
- VERSION = '1.5.1'
51
+ VERSION = '1.5.2'
52
52
 
53
53
  class << self
54
54
  def version
@@ -177,7 +177,6 @@ module Buildr
177
177
  Kernel.send :gem, name, version
178
178
  rescue LoadError, Gem::LoadError => e
179
179
  require 'rubygems/gem_runner'
180
- Gem.manage_gems
181
180
  args = ['install', name, '--version', version] + args
182
181
  Gem::GemRunner.new.run(args)
183
182
  Kernel.send :gem, name, version
@@ -223,8 +223,7 @@ module Buildr
223
223
 
224
224
  task :check => [:instrument, :test] do
225
225
  Buildr.ant "cobertura" do |ant|
226
- ant.taskdef :classpath=>Cobertura.requires.join(File::PATH_SEPARATOR), :resource=>"tasks.properties"
227
-
226
+ ant.taskdef :classpath=>Cobertura.dependencies.join(File::PATH_SEPARATOR), :resource=>"tasks.properties"
228
227
  params = { :datafile => Cobertura.data_file }
229
228
 
230
229
  # oh so ugly...
@@ -270,13 +269,15 @@ module Buildr
270
269
  report_target = report_to(format)
271
270
  desc "Run the test cases and produce code coverage reports in #{report_target}"
272
271
  task format => ["instrument", "test"] do
273
- info "Creating test coverage reports in #{report_target}"
274
- Buildr.ant "cobertura" do |ant|
275
- ant.taskdef :resource=>"tasks.properties",
276
- :classpath=>Buildr.artifacts(Cobertura.dependencies).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
277
- ant.send "cobertura-report", :destdir=>report_target, :format=>format, :datafile=>data_file do
278
- Buildr.projects.map(&:cobertura).map(&:sources).flatten.each do |src|
279
- ant.fileset :dir=>src.to_s if File.exist?(src.to_s)
272
+ if Buildr.projects.detect { |project| !project.compile.sources.empty? }
273
+ info "Creating test coverage reports in #{report_target}"
274
+ Buildr.ant "cobertura" do |ant|
275
+ ant.taskdef :resource=>"tasks.properties",
276
+ :classpath=>Buildr.artifacts(Cobertura.dependencies).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
277
+ ant.send "cobertura-report", :destdir=>report_target, :format=>format, :datafile=>data_file do
278
+ Buildr.projects.map(&:cobertura).map(&:sources).flatten.each do |src|
279
+ ant.fileset :dir=>src.to_s if File.exist?(src.to_s)
280
+ end
280
281
  end
281
282
  end
282
283
  end