buildr 1.3.5-java → 1.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
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 +148 -132
  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
@@ -15,11 +15,11 @@
15
15
 
16
16
 
17
17
  module Buildr
18
-
18
+
19
19
  #
20
20
  # See ArtifactNamespace#need
21
21
  class VersionRequirement
22
-
22
+
23
23
  CMP_PROCS = Gem::Requirement::OPS.dup
24
24
  CMP_REGEX = Gem::Requirement::OP_RE.dup
25
25
  CMP_CHARS = CMP_PROCS.keys.join
@@ -31,16 +31,16 @@ module Buildr
31
31
  def version?(str)
32
32
  /^\s*[#{VER_CHARS}]+\s*$/ === str
33
33
  end
34
-
34
+
35
35
  # is +str+ a version requirement?
36
36
  def requirement?(str)
37
37
  /[#{BOOL_CHARS}#{CMP_CHARS}\(\)]/ === str
38
38
  end
39
-
39
+
40
40
  # :call-seq:
41
41
  # VersionRequirement.create(" >1 <2 !(1.5) ") -> requirement
42
42
  #
43
- # parse the +str+ requirement
43
+ # parse the +str+ requirement
44
44
  def create(str)
45
45
  instance_eval normalize(str)
46
46
  rescue StandardError => e
@@ -61,7 +61,7 @@ module Buildr
61
61
  vreq.negative = !vreq.negative
62
62
  vreq
63
63
  end
64
-
64
+
65
65
  def normalize(str)
66
66
  str = str.strip
67
67
  if str[/[^\s\(\)#{BOOL_CHARS + VER_CHARS + CMP_CHARS}]/]
@@ -147,7 +147,7 @@ module Buildr
147
147
  def &(other)
148
148
  operation(:&, other)
149
149
  end
150
-
150
+
151
151
  # return the parsed expression
152
152
  def to_s
153
153
  str = requirements.map(&:to_s).join(" " + @op.to_s + " ").to_s
@@ -160,7 +160,7 @@ module Buildr
160
160
  protected
161
161
  attr_reader :requirements, :op
162
162
  def operation(op, other)
163
- @op ||= op
163
+ @op ||= op
164
164
  if negative == other.negative && @op == op && other.requirements.size == 1
165
165
  @requirements << other.requirements.first
166
166
  self
@@ -25,7 +25,7 @@ module Buildr
25
25
 
26
26
  # Returns the archive from this path.
27
27
  attr_reader :root
28
-
28
+
29
29
  def initialize(root, path)
30
30
  @root = root
31
31
  @path = path.empty? ? path : "#{path}/"
@@ -41,10 +41,13 @@ module Buildr
41
41
  if File.directory?(path)
42
42
  in_directory path do |file, rel_path|
43
43
  dest = "#{@path}#{rel_path}"
44
- trace "Adding #{dest}"
45
- file_map[dest] = file
44
+ unless excluded?(dest)
45
+ trace "Adding #{dest}"
46
+ file_map[dest] = file
47
+ end
46
48
  end
47
- else
49
+ end
50
+ unless File.basename(path) == "."
48
51
  trace "Adding #{@path}#{File.basename(path)}"
49
52
  file_map["#{@path}#{File.basename(path)}"] = path
50
53
  end
@@ -61,7 +64,8 @@ module Buildr
61
64
  # include(*files, :merge=>true) => self
62
65
  def include(*args)
63
66
  options = args.pop if Hash === args.last
64
- files = args.flatten
67
+ files = to_artifacts(args)
68
+ raise 'AchiveTask.include() values should not include nil' if files.include? nil
65
69
 
66
70
  if options.nil? || options.empty?
67
71
  @includes.include *files.flatten
@@ -74,7 +78,8 @@ module Buildr
74
78
  include_as files.first.to_s, options[:as]
75
79
  elsif options[:from]
76
80
  raise 'You can only use the :from option in combination with the :path option' unless options.size == 1
77
- raise 'You canont use the :from option with file names' unless files.empty?
81
+ raise 'You cannot use the :from option with file names' unless files.empty?
82
+ fail 'AchiveTask.include() :from value should not be nil' if [options[:from]].flatten.include? nil
78
83
  [options[:from]].flatten.each { |path| include_as path.to_s, '.' }
79
84
  elsif options[:merge]
80
85
  raise 'You can only use the :merge option in combination with the :path option' unless options.size == 1
@@ -90,7 +95,7 @@ module Buildr
90
95
  # :call-seq:
91
96
  # exclude(*files) => self
92
97
  def exclude(*files)
93
- files = files.flatten.map(&:to_s)
98
+ files = to_artifacts(files)
94
99
  @excludes |= files
95
100
  @excludes |= files.reject { |f| f =~ /\*$/ }.map { |f| "#{f}/*" }
96
101
  self
@@ -101,7 +106,7 @@ module Buildr
101
106
  # merge(*files, :path=>name) => Merge
102
107
  def merge(*args)
103
108
  options = Hash === args.last ? args.pop : {}
104
- files = args.flatten
109
+ files = to_artifacts(args)
105
110
  rake_check_options options, :path
106
111
  raise ArgumentError, "Expected at least one file to merge" if files.empty?
107
112
  path = options[:path] || @path
@@ -172,7 +177,31 @@ module Buildr
172
177
 
173
178
  protected
174
179
 
175
- def include_as(source, as)
180
+ # Convert objects to artifacts, where applicable
181
+ def to_artifacts(files)
182
+ files.flatten.inject([]) do |set, file|
183
+ case file
184
+ when ArtifactNamespace
185
+ set |= file.artifacts
186
+ when Symbol, Hash
187
+ set |= [artifact(file)]
188
+ when /([^:]+:){2,4}/ # A spec as opposed to a file name.
189
+ set |= [Buildr.artifact(file)]
190
+ when Project
191
+ set |= Buildr.artifacts(file.packages)
192
+ when Rake::Task
193
+ set |= [file]
194
+ when Struct
195
+ set |= Buildr.artifacts(file.values)
196
+ else
197
+ # non-artifacts passed as-is; in particular, String paths are
198
+ # unmodified since Rake FileTasks don't use absolute paths
199
+ set |= [file]
200
+ end
201
+ end
202
+ end
203
+
204
+ def include_as(source, as)
176
205
  @sources << proc { source }
177
206
  @actions << proc do |file_map|
178
207
  file = source.to_s
@@ -182,10 +211,13 @@ module Buildr
182
211
  path = rel_path.split('/')[1..-1]
183
212
  path.unshift as unless as == '.'
184
213
  dest = "#{@path}#{path.join('/')}"
185
- trace "Adding #{dest}"
186
- file_map[dest] = file
214
+ unless excluded?(dest)
215
+ trace "Adding #{dest}"
216
+ file_map[dest] = file
217
+ end
187
218
  end
188
- else
219
+ end
220
+ unless as == "."
189
221
  trace "Adding #{@path}#{as}"
190
222
  file_map["#{@path}#{as}"] = file
191
223
  end
@@ -299,13 +331,13 @@ module Buildr
299
331
 
300
332
  # :call-seq:
301
333
  # clean => self
302
- #
303
- # Removes all previously added content from this archive.
334
+ #
335
+ # Removes all previously added content from this archive.
304
336
  # Use this method if you want to remove default content from a package.
305
337
  # For example, package(:jar) by default includes compiled classes and resources,
306
338
  # using this method, you can create an empty jar and afterwards add the
307
339
  # desired content to it.
308
- #
340
+ #
309
341
  # package(:jar).clean.include path_to('desired/content')
310
342
  def clean
311
343
  @paths = { '' => Path.new(self, '') }
@@ -346,20 +378,21 @@ module Buildr
346
378
  # zip(..).include('foo.zip', :merge=>true).include('bar.zip')
347
379
  # You can also use the method #merge.
348
380
  def include(*files)
349
- @paths[''].include *files
381
+ fail "AchiveTask.include() called with nil values" if files.include? nil
382
+ @paths[''].include *files if files.compact.size > 0
350
383
  self
351
- end
384
+ end
352
385
  alias :add :include
353
386
  alias :<< :include
354
-
387
+
355
388
  # :call-seq:
356
389
  # exclude(*files) => self
357
- #
390
+ #
358
391
  # Excludes files and returns self. Can be used in combination with include to prevent some files from being included.
359
392
  def exclude(*files)
360
393
  @paths[''].exclude *files
361
394
  self
362
- end
395
+ end
363
396
 
364
397
  # :call-seq:
365
398
  # merge(*files) => Merge
@@ -372,7 +405,7 @@ module Buildr
372
405
  # zip(..).merge('src.zip').include('module1/*')
373
406
  def merge(*files)
374
407
  @paths[''].merge *files
375
- end
408
+ end
376
409
 
377
410
  # :call-seq:
378
411
  # path(name) => Path
@@ -433,7 +466,7 @@ module Buildr
433
466
  @prerequisites |= @paths.collect { |name, path| path.sources }.flatten
434
467
  super
435
468
  end
436
-
469
+
437
470
  def needed? #:nodoc:
438
471
  return true unless File.exist?(name)
439
472
  # You can do something like:
@@ -41,9 +41,27 @@ module Buildr
41
41
 
42
42
  class << self
43
43
  private
44
+
45
+ # :stopdoc:
44
46
  def included(mod)
45
47
  mod.extend self
46
48
  end
49
+
50
+ def extend_object(base)
51
+ base.instance_eval { alias :install_old :install } if base.respond_to? :install
52
+ base.instance_eval { alias :uninstall_old :uninstall } if base.respond_to? :uninstall
53
+ base.instance_eval { alias :upload_old :upload } if base.respond_to? :upload
54
+ super
55
+ end
56
+
57
+ def extended(base)
58
+ #We try to keep the previous instance methods defined on the base instance if there were ones.
59
+ base.instance_eval { alias :install :install_old } if base.respond_to? :install_old
60
+ base.instance_eval { alias :uninstall :uninstall_old } if base.respond_to? :uninstall_old
61
+ base.instance_eval { alias :upload :upload_old } if base.respond_to? :upload_old
62
+ end
63
+
64
+ # :startdoc:
47
65
  end
48
66
 
49
67
  # The artifact identifier.
@@ -90,7 +108,7 @@ module Buildr
90
108
 
91
109
  # :call-seq:
92
110
  # pom => Artifact
93
- #
111
+ #
94
112
  # Convenience method that returns a POM artifact.
95
113
  def pom
96
114
  return self if type == :pom
@@ -99,7 +117,7 @@ module Buildr
99
117
 
100
118
  # :call-seq:
101
119
  # sources_artifact => Artifact
102
- #
120
+ #
103
121
  # Convenience method that returns a sources artifact.
104
122
  def sources_artifact
105
123
  sources_spec = to_spec_hash.merge(:classifier=>'sources')
@@ -123,7 +141,7 @@ module Buildr
123
141
  xml.classifier classifier if classifier
124
142
  end
125
143
  end
126
-
144
+
127
145
  def install
128
146
  pom.install if pom && pom != self
129
147
  invoke
@@ -137,7 +155,7 @@ module Buildr
137
155
 
138
156
  def uninstall
139
157
  installed = Buildr.repositories.locate(self)
140
- rm installed if File.exist?(installed)
158
+ rm installed if File.exist?(installed)
141
159
  pom.uninstall if pom && pom != self
142
160
  end
143
161
 
@@ -153,14 +171,13 @@ module Buildr
153
171
  # In the third form, uses a hash with the options :url, :username, :password,
154
172
  # and :permissions. All but :url are optional.
155
173
  def upload(upload_to = nil)
156
- # Where do we release to?
174
+ upload_task(upload_to).invoke
175
+ end
176
+
177
+ def upload_task(upload_to = nil)
157
178
  upload_to ||= Buildr.repositories.release_to
158
179
  upload_to = { :url=>upload_to } unless Hash === upload_to
159
180
  raise ArgumentError, 'Don\'t know where to upload, perhaps you forgot to set repositories.release_to' unless upload_to[:url]
160
- invoke # Make sure we exist.
161
-
162
- # Upload POM ahead of package, so we don't fail and find POM-less package (the horror!)
163
- pom.upload(upload_to) if pom && pom != self
164
181
 
165
182
  # Set the upload URI, including mandatory slash (we expect it to be the base directory).
166
183
  # Username/password may be part of URI, or separate entities.
@@ -169,10 +186,19 @@ module Buildr
169
186
  uri.user = upload_to[:username] if upload_to[:username]
170
187
  uri.password = upload_to[:password] if upload_to[:password]
171
188
 
172
- # Upload artifact relative to base URL, need to create path before uploading.
173
- info "Deploying #{to_spec}"
174
189
  path = group.gsub('.', '/') + "/#{id}/#{version}/#{File.basename(name)}"
175
- URI.upload uri + path, name, :permissions=>upload_to[:permissions]
190
+
191
+ unless task = Buildr.application.lookup(uri+path)
192
+ deps = [self]
193
+ deps << pom.upload_task( upload_to ) if pom && pom != self
194
+
195
+ task = Rake::Task.define_task uri + path => deps do
196
+ # Upload artifact relative to base URL, need to create path before uploading.
197
+ info "Deploying #{to_spec}"
198
+ URI.upload uri + path, name, :permissions=>upload_to[:permissions]
199
+ end
200
+ end
201
+ task
176
202
  end
177
203
 
178
204
  protected
@@ -183,14 +209,14 @@ module Buildr
183
209
  ARTIFACT_ATTRIBUTES.each { |key| instance_variable_set("@#{key}", spec[key]) }
184
210
  self
185
211
  end
186
-
212
+
187
213
  def group_path
188
214
  group.gsub('.', '/')
189
215
  end
190
216
 
191
217
  end
192
218
 
193
-
219
+
194
220
  # A file task referencing an artifact in the local repository.
195
221
  #
196
222
  # This task includes all the artifact attributes (group, id, version, etc). It points
@@ -199,7 +225,7 @@ module Buildr
199
225
  #
200
226
  # Note: You can enhance this task to create the artifact yourself, e.g. download it from
201
227
  # a site that doesn't have a remote repository structure, copy it from a different disk, etc.
202
- class Artifact < Rake::FileCreationTask
228
+ class Artifact < Rake::FileTask
203
229
 
204
230
  # The default artifact type.
205
231
  DEFAULT_TYPE = :jar
@@ -323,19 +349,25 @@ module Buildr
323
349
  # install test
324
350
  # See also Buildr#install and Buildr#upload.
325
351
  def from(path)
326
- path = File.expand_path(path.to_s)
327
- enhance [path] do
328
- mkpath File.dirname(name)
329
- pom.invoke unless type == :pom
330
- cp path, name
331
- info "Installed #{path} as #{to_spec}"
352
+ path = path.is_a?(Rake::Task) ? path : File.expand_path(path.to_s)
353
+ unless exist?
354
+ enhance [path] do
355
+ path = File.expand_path(path.to_s)
356
+ mkpath File.dirname(name)
357
+ pom.invoke unless type == :pom
358
+
359
+ cp path, name
360
+ info "Installed #{path} as #{to_spec}"
361
+ end
332
362
  end
333
363
  unless type == :pom
334
364
  pom.enhance do
365
+ unless pom.exist?
335
366
  mkpath File.dirname(pom.name)
336
367
  File.open(pom.name, 'w') { |file| file.write pom.pom_xml }
337
368
  end
338
369
  end
370
+ end
339
371
  self
340
372
  end
341
373
 
@@ -343,7 +375,7 @@ module Buildr
343
375
 
344
376
  # :call-seq:
345
377
  # download
346
- #
378
+ #
347
379
  # Downloads an artifact from one of the remote repositories, and stores it in the local
348
380
  # repository. Raises an exception if the artifact is not found.
349
381
  #
@@ -353,7 +385,7 @@ module Buildr
353
385
  trace "Downloading #{to_spec}"
354
386
  remote = Buildr.repositories.remote.map { |repo_url| URI === repo_url ? repo_url : URI.parse(repo_url) }
355
387
  remote = remote.each { |repo_url| repo_url.path += '/' unless repo_url.path[-1] == '/' }
356
- fail 'No remote repositories defined!' if remote.empty?
388
+ fail "Unable to download #{to_spec}. No remote repositories defined." if remote.empty?
357
389
  exact_success = remote.find do |repo_url|
358
390
  begin
359
391
  path = "#{group_path}/#{id}/#{version}/#{File.basename(name)}"
@@ -411,21 +443,21 @@ module Buildr
411
443
  fail "Failed to download #{to_spec}, tried the following repositories:\n#{remote_uris.join("\n")}"
412
444
  end
413
445
  end
414
-
415
-
446
+
447
+
416
448
  # An artifact that is optional.
417
449
  # If downloading fails, the user will be informed but it will not raise an exception.
418
450
  class OptionalArtifact < Artifact
419
-
451
+
420
452
  protected
421
-
453
+
422
454
  # If downloading fails, the user will be informed but it will not raise an exception.
423
455
  def download
424
456
  super
425
- rescue
457
+ rescue
426
458
  info "Failed to download #{to_spec}. Skipping it."
427
459
  end
428
-
460
+
429
461
  end
430
462
 
431
463
 
@@ -458,8 +490,9 @@ module Buildr
458
490
  # Sets the path to the local repository.
459
491
  #
460
492
  # The best place to set the local repository path is from a buildr.rb file
461
- # located in your home directory. That way all your projects will share the same
462
- # path, without affecting other developers collaborating on these projects.
493
+ # located in the .buildr directory under your home directory. That way all
494
+ # your projects will share the same path, without affecting other developers
495
+ # collaborating on these projects.
463
496
  def local=(dir)
464
497
  @local = dir ? File.expand_path(dir) : nil
465
498
  end
@@ -697,6 +730,7 @@ module Buildr
697
730
  # * :under -- The group identifier
698
731
  # * :version -- The version number
699
732
  # * :type -- The artifact type (optional)
733
+ # * :classifier -- The artifact classifier (optional)
700
734
  #
701
735
  # For example:
702
736
  # group 'xbean', 'xbean_xpath', 'xmlpublic', :under=>'xmlbeans', :version=>'2.1.0'
@@ -704,8 +738,14 @@ module Buildr
704
738
  # group %w{xbean xbean_xpath xmlpublic}, :under=>'xmlbeans', :version=>'2.1.0'
705
739
  def group(*args)
706
740
  hash = args.pop
707
- args.flatten.map { |id| artifact :group=>hash[:under], :type=>hash[:type], :version=>hash[:version], :id=>id }
708
- end
741
+ args.flatten.map do |id|
742
+ artifact :group => hash[:under],
743
+ :type => hash[:type],
744
+ :version => hash[:version],
745
+ :classifier => hash[:classifier],
746
+ :id => id
747
+ end
748
+ end
709
749
 
710
750
  # :call-seq:
711
751
  # install(artifacts)
@@ -738,11 +778,10 @@ module Buildr
738
778
  def upload(*args, &block)
739
779
  artifacts = artifacts(args)
740
780
  raise ArgumentError, 'This method can only upload artifacts' unless artifacts.all? { |f| f.respond_to?(:to_spec) }
781
+ upload_artifacts_tasks = artifacts.map { |artifact| artifact.upload_task }
741
782
  task('upload').tap do |task|
742
783
  task.enhance &block if block
743
- task.enhance artifacts do
744
- artifacts.each { |artifact| artifact.upload }
745
- end
784
+ task.enhance upload_artifacts_tasks
746
785
  end
747
786
  end
748
787