ivy4r 0.8.1 → 0.9.0

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.
@@ -1,3 +1,9 @@
1
+ === 0.9.0 / 2009-11-16
2
+
3
+ * Add a new configuration option for compile, test and package with name 'type'. The type can
4
+ be used as defined in ivy to only get artifacts of given type(s). One or more types can be
5
+ set as an array to this option. If no type is given all artifacts are retrieved.
6
+
1
7
  === 0.8.1 / 2009-11-12
2
8
 
3
9
  * the project version is NOT set anymore by the the 'before_define' of the extension. The reason
@@ -3,32 +3,17 @@ require 'ivy4r'
3
3
  module Buildr
4
4
  module Ivy
5
5
 
6
- # TODO extend extension to download ivy stuff with dependencies automatically
7
- # VERSION = '2.1.0-rc1'
8
-
9
6
  class << self
10
-
11
7
  def setting(*keys)
12
8
  setting = Buildr.settings.build['ivy']
13
9
  keys.each { |key| setting = setting[key] unless setting.nil? }
14
10
  setting
15
11
  end
16
-
17
- # def version
18
- # setting['version'] || VERSION
19
- # end
20
- # def dependencies
21
- # @dependencies ||= [
22
- # "org.apache.ivy:ivy:jar:#{version}",
23
- # 'com.jcraft:jsch:jar:1.41',
24
- # 'oro:oro:jar:2.08'
25
- # ]
26
- # end
27
12
  end
28
13
 
29
14
  class IvyConfig
30
15
  TARGETS = [:compile, :test, :package]
31
- TYPES = [:conf, :include, :exclude]
16
+ TYPES = [:conf, :type, :include, :exclude]
32
17
 
33
18
  attr_accessor :extension_dir, :resolved
34
19
 
@@ -83,11 +68,26 @@ module Buildr
83
68
 
84
69
  # Returns the artifacts for given configurations as array
85
70
  # this is a post resolve task.
86
- def deps(*confs)
87
- confs = confs.reject {|c| c.nil? || c.blank? }
71
+ # the arguments are checked for the following:
72
+ # 1. if exactly two arrays are given args[0] is used for confs and args[1] is used for types
73
+ # 2. if not exactly two arrays all args are used as confs
74
+ def deps(*args)
75
+ if args.size == 2 && args[0].kind_of?(Array) && args[1].kind_of?(Array)
76
+ confs, types = args[0], args[1]
77
+ else
78
+ confs, types = args.flatten, []
79
+ end
80
+
81
+ [confs, types].each do |t|
82
+ t.reject! {|c| c.nil? || c.blank? }
83
+ end
84
+
88
85
  unless confs.empty?
89
- pathid = "ivy.deps." + confs.join('.')
90
- ivy4r.cachepath :conf => confs.join(','), :pathid => pathid
86
+ pathid = "ivy.deps." + confs.join('.') + '.' + types.join('.')
87
+ params = {:conf => confs.join(','), :pathid => pathid}
88
+ params[:type] = types.join(',') unless types.nil? || types.size == 0
89
+
90
+ ivy4r.cachepath params
91
91
  end
92
92
  end
93
93
 
@@ -346,12 +346,12 @@ module Buildr
346
346
  # <tt>project.ivy.filter('server', 'client', :include => /b.*.jar/, :exclude => [/a\.jar/, /other.*\.jar/])</tt>
347
347
  def filter(*confs)
348
348
  filter = confs.last.kind_of?(Hash) ? confs.pop : {}
349
- unless (filter.keys - [:include, :exclude]).empty?
349
+ unless (filter.keys - (TYPES - [:conf])).empty?
350
350
  raise ArgumentError, "Invalid filter use :include and/or :exclude only: given #{filter.keys.inspect}"
351
351
  end
352
- includes, excludes = filter[:include] || [], filter[:exclude] || []
352
+ includes, excludes, types = filter[:include] || [], filter[:exclude] || [], filter[:type] || []
353
353
 
354
- artifacts = deps(*confs.flatten)
354
+ artifacts = deps(confs.flatten, types.flatten)
355
355
  if artifacts
356
356
  artifacts = artifacts.find_all do |lib|
357
357
  lib = File.basename(lib)
@@ -471,8 +471,9 @@ For more configuration options see IvyConfig.
471
471
  project.task :compiledeps => resolve_target do
472
472
  includes = project.ivy.compile_include
473
473
  excludes = project.ivy.compile_exclude
474
+ types = project.ivy.compile_type
474
475
  confs = [project.ivy.compile_conf].flatten
475
- if deps = project.ivy.filter(confs, :include => includes, :exclude => excludes)
476
+ if deps = project.ivy.filter(confs, :type => types, :include => includes, :exclude => excludes)
476
477
  project.compile.with [deps, project.compile.dependencies].flatten
477
478
  info "Ivy adding compile dependencies '#{confs.join(', ')}' to project '#{project.name}'"
478
479
  end
@@ -483,8 +484,9 @@ For more configuration options see IvyConfig.
483
484
  project.task :testdeps => resolve_target do
484
485
  includes = project.ivy.test_include
485
486
  excludes = project.ivy.test_exclude
487
+ types = project.ivy.test_type
486
488
  confs = [project.ivy.test_conf, project.ivy.compile_conf].flatten.uniq
487
- if deps = project.ivy.filter(confs, :include => includes, :exclude => excludes)
489
+ if deps = project.ivy.filter(confs, :type => types, :include => includes, :exclude => excludes)
488
490
  project.test.with [deps, project.test.dependencies].flatten
489
491
  info "Ivy adding test dependencies '#{confs.join(', ')}' to project '#{project.name}'"
490
492
  end
@@ -523,8 +525,9 @@ For more configuration options see IvyConfig.
523
525
  task = project.task "#{pkg.name}deps" => project.ivy.file_project.task('ivy:resolve') do
524
526
  includes = project.ivy.package_include
525
527
  excludes = project.ivy.package_exclude
528
+ types = project.ivy.package_type
526
529
  confs = project.ivy.package_conf
527
- if deps = project.ivy.filter(confs, :include => includes, :exclude => excludes)
530
+ if deps = project.ivy.filter(confs, :type => types, :include => includes, :exclude => excludes)
528
531
  pkg.with :libs => [deps, pkg.libs].flatten
529
532
  info "Adding production libs from conf '#{confs.join(', ')}' to WAR '#{pkg.name}' in project '#{project.name}'"
530
533
  end
@@ -35,7 +35,7 @@ is
35
35
  }
36
36
  =end
37
37
  class Ivy4r
38
- VERSION = '0.8.1'
38
+ VERSION = '0.9.0'
39
39
 
40
40
  # Set the ant home directory to load ant classes from if no custom __antwrap__ is provided
41
41
  # and the default provided ant version 1.7.1 should not be used.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ivy4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Klaas Prause
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-12 00:00:00 +01:00
12
+ date: 2009-11-16 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency