lib/java/artifact.rb in buildr-1.2.5 vs lib/java/artifact.rb in buildr-1.2.6

- old
+ new

@@ -544,9 +544,32 @@ fail "Invalid artifact specification in: #{specs.to_s}" end end end + def transitive(*specs) + specs.flatten.inject([]) do |set, spec| + case spec + when /([^:]+:){2,4}/ # A spec as opposed to a file name. + artifact = artifact(spec) + set |= [artifact] unless artifact.type == :pom + set |= POM.load(artifact.pom).dependencies.map { |spec| artifact(spec) } + when Hash + set |= [transitive(spec)] + when String # Must always expand path. + set |= transitive(file(File.expand_path(spec))) + when Project + set |= transitive(spec.packages) + when Rake::Task + set |= spec.respond_to?(:to_spec) ? transitive(spec.to_spec) : [spec] + when Struct + set |= transitive(spec.values) + else + fail "Invalid artifact specification in: #{specs.to_s}" + end + end + end + # :call-seq: # groups(ids, :under=>group_name, :version=>number) => artifacts # # Convenience method for defining multiple artifacts that belong to the same group and version. # Accepts multiple artifact identifiers follows by two hash values: