ivy4r 0.9.2 → 0.9.3

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,14 @@
1
+ === 0.9.3 / 2009-11-18
2
+
3
+ * Sorting of compile and test dependencies to prevent problems with old jars that are added by
4
+ buildr automatically, i.e. log4j-1.2.9 for cobertura or JUnit 4.4 if tests are using a newer version.
5
+ The sort order:
6
+ 1. all project dependencies as classes, resources and this like in the order the are contained in path
7
+ 2. all ivy dependencies
8
+ 3. all dependencies added by buildr to the targets
9
+ * Deleted 'to_ivy_file' functionality because it was not working as expected. The function used the
10
+ wrong ivy context and was not able to resolve all variables within the file from the correct ivy context.
11
+
1
12
  === 0.9.2 / 2009-11-16
2
13
 
3
14
  * Added new method to generate an ivy file from a resolved module descriptor, via the java
@@ -22,7 +22,6 @@ lib/ivy/retrieve.rb
22
22
  lib/ivy/settings.rb
23
23
  lib/ivy/target.rb
24
24
  lib/ivy/targets.rb
25
- lib/ivy/to_ivy_file.rb
26
25
  lib/ivy4r.rb
27
26
  lib/rake/ivy_extension.rb
28
27
  test/buildlist/p1/buildfile
@@ -334,17 +334,6 @@ module Buildr
334
334
  end
335
335
  end
336
336
 
337
- # Sets the properties for creation of an ivy file from resolved descriptor as an post_resolve task.
338
- def to_ivy_file(args)
339
- raise "The output file ':file' must be specified for 'to_ivy_file'" unless args.member? :file
340
- raise "Only :file and :overwrite are allowed arguments for 'to_ivy_file'" if (args.keys - [:file, :overwrite]).size > 0
341
- post_resolve do
342
- FileUtils.mkdir_p File.dirname(args[:file])
343
- ivy4r.to_ivy_file args
344
- @project.send(:info, "Created ivy file: '#{args[:file]}'")
345
- end
346
- end
347
-
348
337
  # Adds given block as post resolve action that is executed directly after #resolve has been called.
349
338
  # Yields this ivy config object into block.
350
339
  # <tt>project.ivy.post_resolve { |ivy| p "all deps:" + ivy.deps('all').join(", ") }</tt>
@@ -477,6 +466,7 @@ For more configuration options see IvyConfig.
477
466
  include Buildr::Extension
478
467
 
479
468
  class << self
469
+
480
470
  def add_ivy_deps_to_java_tasks(project)
481
471
  resolve_target = project.ivy.file_project.task('ivy:resolve')
482
472
  project.task :compiledeps => resolve_target do
@@ -486,6 +476,7 @@ For more configuration options see IvyConfig.
486
476
  confs = [project.ivy.compile_conf].flatten
487
477
  if deps = project.ivy.filter(confs, :type => types, :include => includes, :exclude => excludes)
488
478
  project.compile.with [deps, project.compile.dependencies].flatten
479
+ sort_dependencies(project.compile.dependencies, deps, project.path_to(''))
489
480
  info "Ivy adding compile dependencies '#{confs.join(', ')}' to project '#{project.name}'"
490
481
  end
491
482
  end
@@ -499,6 +490,8 @@ For more configuration options see IvyConfig.
499
490
  confs = [project.ivy.test_conf, project.ivy.compile_conf].flatten.uniq
500
491
  if deps = project.ivy.filter(confs, :type => types, :include => includes, :exclude => excludes)
501
492
  project.test.with [deps, project.test.dependencies].flatten
493
+ sort_dependencies(project.test.dependencies, deps, project.path_to(''))
494
+ sort_dependencies(project.test.compile.dependencies, deps, project.path_to(''))
502
495
  info "Ivy adding test dependencies '#{confs.join(', ')}' to project '#{project.name}'"
503
496
  end
504
497
  end
@@ -518,6 +511,35 @@ For more configuration options see IvyConfig.
518
511
  end
519
512
  end
520
513
 
514
+ # Sorts the dependencies in #deps replacing the old order.
515
+ # Sorting is done as follows:
516
+ # 1. all dependencies that belong to the project identified by #project_path,
517
+ # .i.e. instrumented-classes, resources in the order the are contained in the array
518
+ # 2. all ivy dependencies identified by #ivy_deps
519
+ # 3. all dependencies added automatically by buildr
520
+ def sort_dependencies(deps, ivy_deps, project_path)
521
+ old_deps = deps.dup
522
+ belongs_to_project = /#{project_path}/
523
+ deps.sort! do |a, b|
524
+ a_belongs_to_project = belongs_to_project.match(a.to_s)
525
+ b_belongs_to_project = belongs_to_project.match(b.to_s)
526
+ a_ivy = ivy_deps.member? a
527
+ b_ivy = ivy_deps.member? b
528
+
529
+ if a_belongs_to_project && !b_belongs_to_project
530
+ -1
531
+ elsif !a_belongs_to_project && b_belongs_to_project
532
+ 1
533
+ elsif a_ivy && !b_ivy
534
+ -1
535
+ elsif !a_ivy && b_ivy
536
+ 1
537
+ else
538
+ old_deps.index(a) <=> old_deps.index(b)
539
+ end
540
+ end
541
+ end
542
+
521
543
  def add_manifest_to_distributeables(project)
522
544
  pkgs = project.packages.find_all { |pkg| [:jar, :war, :ear].member? pkg.type }
523
545
  pkgs.each do |pkg|
@@ -15,7 +15,6 @@ require 'ivy/retrieve'
15
15
  require 'ivy/publish'
16
16
  require 'ivy/report'
17
17
  require 'ivy/buildlist'
18
- require 'ivy/to_ivy_file'
19
18
 
20
19
  =begin
21
20
  finished
@@ -35,7 +35,7 @@ is
35
35
  }
36
36
  =end
37
37
  class Ivy4r
38
- VERSION = '0.9.2'
38
+ VERSION = '0.9.3'
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.
@@ -150,13 +150,7 @@ class Ivy4r
150
150
  def report(*params)
151
151
  Ivy::Report.new(ant).execute(*params)
152
152
  end
153
-
154
- # Creates ivy file for last resolved descriptor using the underlying java facilities
155
- # (ModuleDescriptor.toIvyFile(java.io.File)).
156
- def to_ivy_file(*params)
157
- Ivy::ToIvyFile.new(ant).execute(*params)
158
- end
159
-
153
+
160
154
  # Used to get or set ant properties.
161
155
  # [set] <tt>property['name'] = value</tt> sets the ant property with name to given value no overwrite
162
156
  # [get] <tt>property[matcher]</tt> gets property that is equal via case equality operator (<tt>===</tt>)
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.9.2
4
+ version: 0.9.3
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-16 00:00:00 +01:00
12
+ date: 2009-11-18 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -94,7 +94,6 @@ files:
94
94
  - lib/ivy/settings.rb
95
95
  - lib/ivy/target.rb
96
96
  - lib/ivy/targets.rb
97
- - lib/ivy/to_ivy_file.rb
98
97
  - lib/ivy4r.rb
99
98
  - lib/rake/ivy_extension.rb
100
99
  - test/buildlist/p1/buildfile
@@ -1,31 +0,0 @@
1
- require 'ivy/target'
2
-
3
- module Ivy
4
- class ToIvyFile < Ivy::Target
5
- def parameter
6
- [
7
- Parameter.new(:file, true),
8
- Parameter.new(:overwrite, false)
9
- ]
10
- end
11
-
12
- protected
13
- def execute_ivy
14
- descriptor = ant_references.find {|tuple| tuple[0] == 'ivy.resolved.descriptor'}
15
- raise 'to_ivy_file is a post resolve task but no resolved descriptor was found!' if descriptor.nil?
16
- descriptor = descriptor[1]
17
-
18
- file = params[:file]
19
- overwrite = params[:overwrite] && params[:overwrite].to_s == 'true'
20
- unless !File.exists?(file) || overwrite
21
- raise "Output file '#{file}' exists and ':overwrite' is false or unset: #{params[:overwrite]}"
22
- end
23
-
24
- descriptor.toIvyFile(java.io.File.new(file))
25
- end
26
-
27
- def create_return_values
28
- nil
29
- end
30
- end
31
- end