buildr 1.3.5-x86-mswin32 → 1.4.0-x86-mswin32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. data/CHANGELOG +153 -8
  2. data/README.rdoc +1 -1
  3. data/addon/buildr/antlr.rb +5 -5
  4. data/addon/buildr/drb.rb +18 -18
  5. data/addon/buildr/hibernate.rb +18 -14
  6. data/addon/buildr/javacc.rb +4 -4
  7. data/addon/buildr/jetty.rb +5 -5
  8. data/addon/buildr/nailgun.rb +23 -23
  9. data/addon/buildr/openjpa.rb +1 -1
  10. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  11. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  12. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  13. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  14. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  15. data/addon/buildr/protobuf.rb +75 -0
  16. data/addon/buildr/xmlbeans.rb +5 -5
  17. data/buildr.buildfile +2 -2
  18. data/buildr.gemspec +8 -7
  19. data/doc/_layouts/default.html +2 -2
  20. data/doc/artifacts.textile +4 -4
  21. data/doc/building.textile +35 -3
  22. data/doc/contributing.textile +5 -0
  23. data/doc/download.textile +16 -5
  24. data/doc/extending.textile +38 -12
  25. data/doc/installing.textile +6 -5
  26. data/doc/languages.textile +182 -42
  27. data/doc/more_stuff.textile +2 -2
  28. data/doc/packaging.textile +14 -15
  29. data/doc/projects.textile +7 -2
  30. data/doc/quick_start.textile +4 -4
  31. data/doc/scripts/buildr-git.rb +63 -63
  32. data/doc/scripts/gitflow.rb +21 -21
  33. data/doc/settings_profiles.textile +9 -2
  34. data/doc/testing.textile +16 -5
  35. data/etc/KEYS +38 -0
  36. data/lib/buildr.rb +1 -1
  37. data/lib/buildr/core.rb +1 -0
  38. data/lib/buildr/core/application.rb +33 -27
  39. data/lib/buildr/core/build.rb +41 -28
  40. data/lib/buildr/core/cc.rb +172 -0
  41. data/lib/buildr/core/checks.rb +1 -1
  42. data/lib/buildr/core/common.rb +7 -6
  43. data/lib/buildr/core/compile.rb +7 -8
  44. data/lib/buildr/core/doc.rb +263 -0
  45. data/lib/buildr/core/environment.rb +6 -6
  46. data/lib/buildr/core/filter.rb +77 -35
  47. data/lib/buildr/core/generate.rb +7 -7
  48. data/lib/buildr/core/help.rb +1 -1
  49. data/lib/buildr/core/osx.rb +6 -6
  50. data/lib/buildr/core/progressbar.rb +4 -4
  51. data/lib/buildr/core/project.rb +144 -36
  52. data/lib/buildr/core/shell.rb +34 -34
  53. data/lib/buildr/core/test.rb +89 -20
  54. data/lib/buildr/core/transports.rb +8 -7
  55. data/lib/buildr/core/util.rb +77 -23
  56. data/lib/buildr/groovy/bdd.rb +5 -5
  57. data/lib/buildr/groovy/compiler.rb +19 -15
  58. data/lib/buildr/groovy/shell.rb +6 -6
  59. data/lib/buildr/ide/eclipse.rb +148 -75
  60. data/lib/buildr/ide/eclipse/java.rb +3 -3
  61. data/lib/buildr/ide/eclipse/plugin.rb +8 -5
  62. data/lib/buildr/ide/eclipse/scala.rb +4 -2
  63. data/lib/buildr/ide/idea.rb +2 -2
  64. data/lib/buildr/ide/idea7x.rb +23 -4
  65. data/lib/buildr/java.rb +1 -0
  66. data/lib/buildr/java/ant.rb +4 -4
  67. data/lib/buildr/java/bdd.rb +51 -54
  68. data/lib/buildr/java/cobertura.rb +57 -35
  69. data/lib/buildr/java/commands.rb +14 -5
  70. data/lib/buildr/java/compiler.rb +3 -217
  71. data/lib/buildr/java/deprecated.rb +4 -4
  72. data/lib/buildr/java/doc.rb +70 -0
  73. data/lib/buildr/java/emma.rb +22 -22
  74. data/lib/buildr/java/jruby.rb +4 -4
  75. data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
  76. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  77. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
  78. data/lib/buildr/java/packaging.rb +30 -29
  79. data/lib/buildr/java/pom.rb +4 -4
  80. data/lib/buildr/java/rjb.rb +6 -6
  81. data/lib/buildr/java/test_result.rb +61 -85
  82. data/lib/buildr/java/tests.rb +44 -27
  83. data/lib/buildr/java/version_requirement.rb +8 -8
  84. data/lib/buildr/packaging/archive.rb +55 -22
  85. data/lib/buildr/packaging/artifact.rb +75 -36
  86. data/lib/buildr/packaging/artifact_namespace.rb +90 -78
  87. data/lib/buildr/packaging/artifact_search.rb +5 -5
  88. data/lib/buildr/packaging/gems.rb +11 -7
  89. data/lib/buildr/packaging/package.rb +10 -7
  90. data/lib/buildr/packaging/tar.rb +14 -14
  91. data/lib/buildr/packaging/version_requirement.rb +30 -10
  92. data/lib/buildr/packaging/ziptask.rb +51 -13
  93. data/lib/buildr/scala.rb +1 -0
  94. data/lib/buildr/scala/bdd.rb +25 -20
  95. data/lib/buildr/scala/compiler.rb +87 -40
  96. data/lib/buildr/scala/doc.rb +106 -0
  97. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  98. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  99. data/lib/buildr/scala/shell.rb +14 -9
  100. data/lib/buildr/scala/tests.rb +33 -26
  101. data/lib/buildr/shell.rb +33 -33
  102. data/rakelib/all-in-one.rake +113 -0
  103. data/rakelib/checks.rake +1 -1
  104. data/rakelib/doc.rake +7 -0
  105. data/rakelib/package.rake +1 -1
  106. data/rakelib/release.rake +9 -6
  107. data/rakelib/rspec.rake +26 -7
  108. data/rakelib/setup.rake +15 -3
  109. data/rakelib/stage.rake +18 -11
  110. data/spec/addon/drb_spec.rb +25 -25
  111. data/spec/core/application_spec.rb +111 -21
  112. data/spec/core/build_spec.rb +16 -15
  113. data/spec/core/cc_spec.rb +174 -0
  114. data/spec/core/checks_spec.rb +34 -34
  115. data/spec/core/common_spec.rb +51 -5
  116. data/spec/core/compile_spec.rb +89 -14
  117. data/spec/core/extension_spec.rb +127 -19
  118. data/spec/core/generate_spec.rb +2 -2
  119. data/spec/core/project_spec.rb +10 -10
  120. data/spec/core/test_spec.rb +144 -35
  121. data/spec/core/transport_spec.rb +8 -8
  122. data/spec/core/util_spec.rb +63 -5
  123. data/spec/groovy/bdd_spec.rb +5 -5
  124. data/spec/groovy/compiler_spec.rb +29 -18
  125. data/spec/ide/eclipse_spec.rb +185 -9
  126. data/spec/ide/idea7x_spec.rb +22 -10
  127. data/spec/java/ant_spec.rb +9 -5
  128. data/spec/java/bdd_spec.rb +29 -37
  129. data/spec/java/cobertura_spec.rb +12 -12
  130. data/spec/java/commands_spec.rb +34 -0
  131. data/spec/java/compiler_spec.rb +53 -53
  132. data/spec/java/emma_spec.rb +11 -11
  133. data/spec/java/java_spec.rb +10 -10
  134. data/spec/java/packaging_spec.rb +67 -20
  135. data/spec/java/test_coverage_helper.rb +18 -18
  136. data/spec/java/tests_spec.rb +13 -9
  137. data/spec/packaging/archive_spec.rb +187 -20
  138. data/spec/packaging/artifact_namespace_spec.rb +172 -83
  139. data/spec/packaging/artifact_spec.rb +83 -18
  140. data/spec/packaging/packaging_spec.rb +41 -14
  141. data/spec/sandbox.rb +23 -12
  142. data/spec/scala/bdd_spec.rb +13 -8
  143. data/spec/scala/compiler_spec.rb +18 -13
  144. data/spec/scala/scala.rb +3 -3
  145. data/spec/scala/tests_spec.rb +46 -24
  146. data/spec/spec_helpers.rb +28 -10
  147. data/spec/version_requirement_spec.rb +25 -11
  148. metadata +149 -133
  149. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  150. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
  151. data/rakelib/stage.rake~ +0 -213
@@ -27,6 +27,12 @@ module Java
27
27
  #
28
28
  # Runs Java with the specified arguments.
29
29
  #
30
+ # Each argument should be provided as separate array value, e.g.
31
+ #
32
+ # java("-jar", "yuicompressor-2.4.2.jar", "--type","css",
33
+ # "src/main/webapp/styles/styles-all.css",
34
+ # "-o", "src/main/webapp/styles/styles-all-min.css")
35
+ #
30
36
  # The last argument may be a Hash with additional options:
31
37
  # * :classpath -- One or more file names, tasks or artifact specifications.
32
38
  # These are all expanded into artifacts, and all tasks are invoked.
@@ -39,7 +45,11 @@ module Java
39
45
  options[:verbose] ||= Buildr.application.options.trace || false
40
46
  rake_check_options options, :classpath, :java_args, :properties, :name, :verbose
41
47
 
42
- name = options[:name] || "java #{args.first}"
48
+ name = options[:name]
49
+ if name.nil?
50
+ name = "java #{args.first}"
51
+ end
52
+
43
53
  cmd_args = [path_to_bin('java')]
44
54
  classpath = classpath_from(options)
45
55
  cmd_args << '-classpath' << classpath.join(File::PATH_SEPARATOR) unless classpath.empty?
@@ -47,16 +57,15 @@ module Java
47
57
  cmd_args += (options[:java_args] || (ENV['JAVA_OPTS'] || ENV['JAVA_OPTIONS']).to_s.split).flatten
48
58
  cmd_args += args.flatten.compact
49
59
  unless Buildr.application.options.dryrun
50
- info "Running #{name}"
60
+ info "Running #{name}" if name && options[:verbose]
51
61
  block = lambda { |ok, res| fail "Failed to execute #{name}, see errors above" unless ok } unless block
52
- puts cmd_args.join(' ') if Buildr.application.options.trace
53
62
  cmd_args = cmd_args.map(&:inspect).join(' ') if Util.win_os?
54
63
  sh(*cmd_args) do |ok, ps|
55
64
  block.call ok, ps
56
65
  end
57
66
  end
58
67
  end
59
-
68
+
60
69
  # :call-seq:
61
70
  # apt(*files, options)
62
71
  #
@@ -127,7 +136,7 @@ module Java
127
136
  info "Compiling #{files.size} source files in #{name}"
128
137
  trace (['javac'] + cmd_args).join(' ')
129
138
  Java.load
130
- Java.com.sun.tools.javac.Main.compile(cmd_args.to_java(Java.java.lang.String)) == 0 or
139
+ Java.com.sun.tools.javac.Main.compile(cmd_args.to_java(Java.java.lang.String)) == 0 or
131
140
  fail 'Failed to compile, see errors above'
132
141
  end
133
142
  end
@@ -36,7 +36,7 @@ module Buildr
36
36
  # * :source -- Source code compatibility.
37
37
  # * :target -- Bytecode compatibility.
38
38
  # * :lint -- Lint option is one of true, false (default), name (e.g. 'cast') or array.
39
- # * :other -- Array of options passed to the compiler
39
+ # * :other -- Array of options passed to the compiler
40
40
  # (e.g. ['-implicit:none', '-encoding', 'iso-8859-1'])
41
41
  class Javac < Base
42
42
 
@@ -47,7 +47,7 @@ module Buildr
47
47
  def initialize(project, options) #:nodoc:
48
48
  super
49
49
  options[:debug] = Buildr.options.debug if options[:debug].nil?
50
- options[:warnings] = verbose if options[:warnings].nil?
50
+ options[:warnings] ||= false
51
51
  options[:deprecation] ||= false
52
52
  options[:lint] ||= false
53
53
  end
@@ -74,7 +74,7 @@ module Buildr
74
74
  private
75
75
 
76
76
  def javac_args #:nodoc:
77
- args = []
77
+ args = []
78
78
  args << '-nowarn' unless options[:warnings]
79
79
  args << '-verbose' if Buildr.application.options.trace
80
80
  args << '-g' if options[:debug]
@@ -90,219 +90,6 @@ module Buildr
90
90
  end
91
91
 
92
92
  end
93
-
94
- end
95
-
96
-
97
- # Methods added to Project for creating JavaDoc documentation.
98
- module Javadoc
99
-
100
- # A convenient task for creating Javadocs from the project's compile task. Minimizes all
101
- # the hard work to calling #from and #using.
102
- #
103
- # For example:
104
- # javadoc.from(projects('myapp:foo', 'myapp:bar')).using(:windowtitle=>'My App')
105
- # Or, short and sweet:
106
- # desc 'My App'
107
- # define 'myapp' do
108
- # . . .
109
- # javadoc projects('myapp:foo', 'myapp:bar')
110
- # end
111
- class JavadocTask < Rake::Task
112
-
113
- def initialize(*args) #:nodoc:
114
- super
115
- @options = {}
116
- @classpath = []
117
- @sourcepath = []
118
- @files = FileList[]
119
- enhance do |task|
120
- rm_rf target.to_s
121
- generate source_files, File.expand_path(target.to_s), options.merge(:classpath=>classpath, :sourcepath=>sourcepath)
122
- touch target.to_s
123
- end
124
- end
125
-
126
- # The target directory for the generated Javadoc files.
127
- attr_reader :target
128
-
129
- # :call-seq:
130
- # into(path) => self
131
- #
132
- # Sets the target directory and returns self. This will also set the Javadoc task
133
- # as a prerequisite to a file task on the target directory.
134
- #
135
- # For example:
136
- # package :zip, :classifier=>'docs', :include=>javadoc.target
137
- def into(path)
138
- @target = file(path.to_s).enhance([self]) unless @target && @target.to_s == path.to_s
139
- self
140
- end
141
-
142
- # :call-seq:
143
- # include(*files) => self
144
- #
145
- # Includes additional source files and directories when generating the documentation
146
- # and returns self. When specifying a directory, includes all .java files in that directory.
147
- def include(*files)
148
- @files.include *files.flatten.compact
149
- self
150
- end
151
-
152
- # :call-seq:
153
- # exclude(*files) => self
154
- #
155
- # Excludes source files and directories from generating the documentation.
156
- def exclude(*files)
157
- @files.exclude *files
158
- self
159
- end
160
-
161
- # Classpath dependencies.
162
- attr_accessor :classpath
163
-
164
- # :call-seq:
165
- # with(*artifacts) => self
166
- #
167
- # Adds files and artifacts as classpath dependencies, and returns self.
168
- def with(*specs)
169
- @classpath |= Buildr.artifacts(specs.flatten).uniq
170
- self
171
- end
172
-
173
- # Additional sourcepaths that are not part of the documented files.
174
- attr_accessor :sourcepath
175
-
176
- # Returns the Javadoc options.
177
- attr_reader :options
178
-
179
- # :call-seq:
180
- # using(options) => self
181
- #
182
- # Sets the Javadoc options from a hash and returns self.
183
- #
184
- # For example:
185
- # javadoc.using :windowtitle=>'My application'
186
- def using(*args)
187
- args.pop.each { |key, value| @options[key.to_sym] = value } if Hash === args.last
188
- args.each { |key| @options[key.to_sym] = true }
189
- self
190
- end
191
-
192
- # :call-seq:
193
- # from(*sources) => self
194
- #
195
- # Includes files, directories and projects in the Javadoc documentation and returns self.
196
- #
197
- # You can call this method with Java source files and directories containing Java source files
198
- # to include these files in the Javadoc documentation, similar to #include. You can also call
199
- # this method with projects. When called with a project, it includes all the source files compiled
200
- # by that project and classpath dependencies used when compiling.
201
- #
202
- # For example:
203
- # javadoc.from projects('myapp:foo', 'myapp:bar')
204
- def from(*sources)
205
- sources.flatten.each do |source|
206
- case source
207
- when Project
208
- self.enhance source.prerequisites
209
- self.include source.compile.sources
210
- self.with source.compile.dependencies
211
- when Rake::Task, String
212
- self.include source
213
- else
214
- fail "Don't know how to generate Javadocs from #{source || 'nil'}"
215
- end
216
- end
217
- self
218
- end
219
-
220
- def prerequisites() #:nodoc:
221
- super + @files + classpath + sourcepath
222
- end
223
-
224
- def source_files() #:nodoc:
225
- @source_files ||= @files.map(&:to_s).
226
- map { |file| File.directory?(file) ? FileList[File.join(file, "**/*.java")] : file }.
227
- flatten.reject { |file| @files.exclude?(file) }
228
- end
229
-
230
- def needed?() #:nodoc:
231
- return false if source_files.empty?
232
- return true unless File.exist?(target.to_s)
233
- source_files.map { |src| File.stat(src.to_s).mtime }.max > File.stat(target.to_s).mtime
234
- end
235
-
236
- private
237
-
238
- def generate(sources, target, options = {})
239
- cmd_args = [ '-d', target, Buildr.application.options.trace ? '-verbose' : '-quiet' ]
240
- options.reject { |key, value| [:sourcepath, :classpath].include?(key) }.
241
- each { |key, value| value.invoke if value.respond_to?(:invoke) }.
242
- each do |key, value|
243
- case value
244
- when true, nil
245
- cmd_args << "-#{key}"
246
- when false
247
- cmd_args << "-no#{key}"
248
- when Hash
249
- value.each { |k,v| cmd_args << "-#{key}" << k.to_s << v.to_s }
250
- else
251
- cmd_args += Array(value).map { |item| ["-#{key}", item.to_s] }.flatten
252
- end
253
- end
254
- [:sourcepath, :classpath].each do |option|
255
- Array(options[option]).flatten.tap do |paths|
256
- cmd_args << "-#{option}" << paths.flatten.map(&:to_s).join(File::PATH_SEPARATOR) unless paths.empty?
257
- end
258
- end
259
- cmd_args += sources.flatten.uniq
260
- unless Buildr.application.options.dryrun
261
- info "Generating Javadoc for #{name}"
262
- trace (['javadoc'] + cmd_args).join(' ')
263
- Java.load
264
- Java.com.sun.tools.javadoc.Main.execute(cmd_args.to_java(Java.java.lang.String)) == 0 or
265
- fail 'Failed to generate Javadocs, see errors above'
266
- end
267
- end
268
-
269
- end
270
-
271
-
272
- include Extension
273
-
274
- first_time do
275
- desc 'Create the Javadocs for this project'
276
- Project.local_task('javadoc')
277
- end
278
-
279
- before_define do |project|
280
- JavadocTask.define_task('javadoc').tap do |javadoc|
281
- javadoc.into project.path_to(:target, :javadoc)
282
- javadoc.using :windowtitle=>project.comment || project.name
283
- end
284
- end
285
-
286
- after_define do |project|
287
- project.javadoc.from project
288
- end
289
-
290
- # :call-seq:
291
- # javadoc(*sources) => JavadocTask
292
- #
293
- # This method returns the project's Javadoc task. It also accepts a list of source files,
294
- # directories and projects to include when generating the Javadocs.
295
- #
296
- # By default the Javadoc task uses all the source directories from compile.sources and generates
297
- # Javadocs in the target/javadoc directory. This method accepts sources and adds them by calling
298
- # JavadocsTask#from.
299
- #
300
- # For example, if you want to generate Javadocs for a given project that includes all source files
301
- # in two of its sub-projects:
302
- # javadoc projects('myapp:foo', 'myapp:bar').using(:windowtitle=>'Docs for foo and bar')
303
- def javadoc(*sources, &block)
304
- task('javadoc').from(*sources).enhance &block
305
- end
306
93
 
307
94
  end
308
95
 
@@ -344,6 +131,5 @@ end
344
131
 
345
132
  Buildr::Compiler << Buildr::Compiler::Javac
346
133
  class Buildr::Project
347
- include Buildr::Javadoc
348
134
  include Buildr::Apt
349
135
  end
@@ -44,7 +44,7 @@ module Java
44
44
  Buildr.application.deprecated 'See documentation for new way to access Java code.'
45
45
  yield self if block_given?
46
46
  end
47
-
47
+
48
48
  # *Deprecated:* Use Java.load instead.
49
49
  def load
50
50
  Buildr.application.deprecated 'Use Java.load instead.'
@@ -66,19 +66,19 @@ module Java
66
66
  # *Deprecated*: Use Java::Commands.java instead.
67
67
  def java(*args, &block)
68
68
  return send(:method_missing, :java) if args.empty?
69
- Buildr.application.deprecated 'Use Java::Commands.javadoc instead.'
69
+ Buildr.application.deprecated 'Use Java::Commands.java instead.'
70
70
  Commands.java(*args, &block)
71
71
  end
72
72
 
73
73
  # *Deprecated*: Use Java::Commands.apt instead.
74
74
  def apt(*args)
75
- Buildr.application.deprecated 'Use Java::Commands.javadoc instead.'
75
+ Buildr.application.deprecated 'Use Java::Commands.apt instead.'
76
76
  Commands.apt(*args)
77
77
  end
78
78
 
79
79
  # *Deprecated*: Use Java::Commands.javac instead.
80
80
  def javac(*args)
81
- Buildr.application.deprecated 'Use Java::Commands.javadoc instead.'
81
+ Buildr.application.deprecated 'Use Java::Commands.javac instead.'
82
82
  Commands.javac(*args)
83
83
  end
84
84
 
@@ -0,0 +1,70 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ require 'buildr/core/doc'
17
+
18
+ module Buildr
19
+ module Doc
20
+
21
+ # A convenient task for creating Javadocs from the project's compile task. Minimizes all
22
+ # the hard work to calling #from and #using.
23
+ #
24
+ # For example:
25
+ # doc.from(projects('myapp:foo', 'myapp:bar')).using(:windowtitle=>'My App')
26
+ # Or, short and sweet:
27
+ # desc 'My App'
28
+ # define 'myapp' do
29
+ # . . .
30
+ # doc projects('myapp:foo', 'myapp:bar')
31
+ # end
32
+ class Javadoc < Base
33
+
34
+ specify :language => :java, :source_ext => 'java'
35
+
36
+ def generate(sources, target, options = {})
37
+ cmd_args = [ '-d', target, Buildr.application.options.trace ? '-verbose' : '-quiet' ]
38
+ options.reject { |key, value| [:sourcepath, :classpath].include?(key) }.
39
+ each { |key, value| value.invoke if value.respond_to?(:invoke) }.
40
+ each do |key, value|
41
+ case value
42
+ when true, nil
43
+ cmd_args << "-#{key}"
44
+ when false
45
+ cmd_args << "-no#{key}"
46
+ when Hash
47
+ value.each { |k,v| cmd_args << "-#{key}" << k.to_s << v.to_s }
48
+ else
49
+ cmd_args += Array(value).map { |item| ["-#{key}", item.to_s] }.flatten
50
+ end
51
+ end
52
+ [:sourcepath, :classpath].each do |option|
53
+ Array(options[option]).flatten.tap do |paths|
54
+ cmd_args << "-#{option}" << paths.flatten.map(&:to_s).join(File::PATH_SEPARATOR) unless paths.empty?
55
+ end
56
+ end
57
+ cmd_args += sources.flatten.uniq
58
+ unless Buildr.application.options.dryrun
59
+ info "Generating Javadoc for #{project.name}"
60
+ trace (['javadoc'] + cmd_args).join(' ')
61
+ Java.load
62
+ Java.com.sun.tools.javadoc.Main.execute(cmd_args.to_java(Java.java.lang.String)) == 0 or
63
+ fail 'Failed to generate Javadocs, see errors above'
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+ Buildr::Doc.engines << Buildr::Doc::Javadoc
@@ -22,16 +22,16 @@ module Buildr
22
22
  # Provides the <code>emma:html</code> and <code>emma:xml</code> tasks.
23
23
  # Require explicitly using <code>require "buildr/emma"</code>.
24
24
  #
25
- # You can generate emma reports for a single project
25
+ # You can generate emma reports for a single project
26
26
  # using the project name as prefix:
27
27
  #
28
28
  # project_name:emma:html
29
29
  #
30
- # You can also specify which classes to include/exclude from instrumentation by
31
- # passing a class name regexp to the <code>emma.include</code> or
32
- # <code>emma.exclude</code> methods.
33
- #
34
- # define 'someModule' do
30
+ # You can also specify which classes to include/exclude from instrumentation by
31
+ # passing a class name regexp to the <code>emma.include</code> or
32
+ # <code>emma.exclude</code> methods.
33
+ #
34
+ # define 'someModule' do
35
35
  # emma.include 'some.package.*'
36
36
  # emma.exclude 'some.foo.util.SimpleUtil'
37
37
  # end
@@ -58,7 +58,7 @@ module Buildr
58
58
  end
59
59
 
60
60
  def ant
61
-
61
+
62
62
  Buildr.ant 'emma' do |ant|
63
63
  ant.taskdef :resource=>'emma_ant.properties',
64
64
  :classpath=>Buildr.artifacts(dependencies).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
@@ -68,18 +68,18 @@ module Buildr
68
68
  end
69
69
  end
70
70
  end
71
-
71
+
72
72
  class EmmaConfig # :nodoc:
73
-
73
+
74
74
  def initialize(project)
75
75
  @project = project
76
76
  end
77
-
77
+
78
78
  attr_reader :project
79
79
  private :project
80
80
 
81
81
  attr_writer :metadata_file, :coverage_file, :instrumented_dir, :report_dir
82
-
82
+
83
83
  def coverage_file
84
84
  @coverage_file ||= File.join(report_dir, 'coverage.ec')
85
85
  end
@@ -95,7 +95,7 @@ module Buildr
95
95
  def report_dir
96
96
  @report_dir ||= project.path_to(:reports, :emma)
97
97
  end
98
-
98
+
99
99
  def report_to format
100
100
  report_dir
101
101
  end
@@ -107,7 +107,7 @@ module Buildr
107
107
  includes.push(*classPatterns)
108
108
  self
109
109
  end
110
-
110
+
111
111
  def includes
112
112
  @includeClasses ||= []
113
113
  end
@@ -138,7 +138,7 @@ module Buildr
138
138
 
139
139
  after_define do |project|
140
140
  emma = project.emma
141
-
141
+
142
142
  namespace 'emma' do
143
143
  unless project.compile.target.nil?
144
144
  # Instrumented bytecode goes in a different directory. This task creates before running the test
@@ -155,14 +155,14 @@ module Buildr
155
155
  touch task.to_s
156
156
  end
157
157
  end
158
-
158
+
159
159
  task 'instrument' => instrumented
160
-
160
+
161
161
  # We now have two target directories with bytecode.
162
162
  project.test.dependencies.unshift emma.instrumented_dir
163
163
  project.test.with Emma.dependencies
164
164
  project.test.options[:properties]["emma.coverage.out.file"] = emma.coverage_file
165
-
165
+
166
166
  [:xml, :html].each do |format|
167
167
  task format => ['instrument', 'test'] do
168
168
  missing_required_files = [emma.metadata_file, emma.coverage_file].reject { |f| File.exist?(f) }
@@ -192,9 +192,9 @@ module Buildr
192
192
  project.clean do
193
193
  rm_rf [emma.report_dir, emma.coverage_file, emma.metadata_file, emma.instrumented_dir]
194
194
  end
195
-
195
+
196
196
  end
197
-
197
+
198
198
  end
199
199
 
200
200
  class Buildr::Project
@@ -204,7 +204,7 @@ module Buildr
204
204
  namespace "emma" do
205
205
 
206
206
  Project.local_task('instrument') { |name| "Instrumenting #{name}" }
207
-
207
+
208
208
  [:xml, :html].each do |format|
209
209
  desc "Run the test cases and produce code coverage reports in #{format}"
210
210
  task format => ['instrument', 'test'] do
@@ -224,13 +224,13 @@ module Buildr
224
224
  ant.sourcepath do
225
225
  Buildr.projects.map(&:emma).map(&:sources).flatten.map(&:to_s).each do |src|
226
226
  ant.dirset :dir=>src if File.exist?(src)
227
- end
227
+ end
228
228
  end
229
229
  end
230
230
  end
231
231
  end
232
232
  end
233
-
233
+
234
234
  task :clean do
235
235
  rm_rf [report_to, data_file]
236
236
  end