molinillo 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6828b175f84c2dae7fadfaf7c614a3a6198089a11f0e2c20defc697b1108e2b
4
- data.tar.gz: b4e8a71693257b7726be5c21fee26571197b0cd69b1445bb51107aad984b0e89
3
+ metadata.gz: 1b23f59b3ca4c8581474afb4d7f39183c981fa7941820e6f16376ef3f11ac393
4
+ data.tar.gz: e3567469a3033fca6d5bd5829e45b9ff9026eb069930780b0ed6c4da873d83b6
5
5
  SHA512:
6
- metadata.gz: 67df28dfe97c6a0b66d96df61e543fa917de1bd63e2ffa169d8499f62940722a72629b37fe1c7a8db4408d7dfbfc8d718ceac09956a5160c875d74db23ab15cf
7
- data.tar.gz: d750b24f9a1dd5a4a2a846f00c1ef0f6e05fdff166266a9427c9918254ff991c8bc0fb7fae861ec172ac0a305942981d0c991932a282522e2bb0eb7c981a1b13
6
+ metadata.gz: 1bc11782b15142c0514765cbe8d83e60c127338dd59413454269d5b45d5e5c1a41258df931bd504edc3d03932c0e851ba0fa560d40b903c3ccf805a2c25a6acc
7
+ data.tar.gz: 440b4b4b42206cf2a9ed016aeb11e829c69ef6e9d73e3d488f6672fe2217108428c770372a636b8f34a32c713c5925c4cb8aea6a1e608600c412bcfce96e7d8b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Molinillo Changelog
2
2
 
3
+ ## 0.8.0 (2021-08-09)
4
+
5
+ ##### Breaking
6
+
7
+ * Support for Ruby 2.0, 2.1 and 2.2 has been dropped, the minimum supported
8
+ Ruby version is now 2.3.
9
+ [David Rodríguez](https://github.com/deivid-rodriguez)
10
+
11
+ ##### Enhancements
12
+
13
+ * Use `Array#-` in unwind logic, since it performs better than `Array#&`, so it
14
+ speeds up resolution.
15
+ [Lukas Oberhuber](https://github.com/lukaso)
16
+
17
+ * Allow specification provider to customize how dependencies are compared when
18
+ grouping specifications with the same dependencies.
19
+ [David Rodríguez](https://github.com/deivid-rodriguez)
20
+
21
+ ##### Bug Fixes
22
+
23
+ * None.
24
+
25
+
3
26
  ## 0.7.0 (2020-10-21)
4
27
 
5
28
  ##### Breaking
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Molinillo
2
2
 
3
- [![Build Status](https://img.shields.io/travis/CocoaPods/Molinillo/master.svg?style=flat)](https://travis-ci.org/CocoaPods/Molinillo)
3
+ [![Build Status](https://github.com/CocoaPods/Molinillo/workflows/test/badge.svg)](https://github.com/CocoaPods/Molinillo/actions?query=branch%3Amaster)
4
4
  [![Coverage](https://img.shields.io/codeclimate/coverage/github/CocoaPods/Molinillo.svg?style=flat)](https://codeclimate.com/github/CocoaPods/Molinillo)
5
5
  [![Code Climate](https://img.shields.io/codeclimate/github/CocoaPods/Molinillo.svg?style=flat)](https://codeclimate.com/github/CocoaPods/Molinillo)
6
6
 
@@ -26,6 +26,13 @@ module Molinillo
26
26
  end
27
27
  end
28
28
 
29
+ # (see Molinillo::SpecificationProvider#dependencies_equal?)
30
+ def dependencies_equal?(dependencies, other_dependencies)
31
+ with_no_such_dependency_error_handling do
32
+ specification_provider.dependencies_equal?(dependencies, other_dependencies)
33
+ end
34
+ end
35
+
29
36
  # (see Molinillo::SpecificationProvider#name_for)
30
37
  def name_for(dependency)
31
38
  with_no_such_dependency_error_handling do
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'set'
4
3
  require 'tsort'
5
4
 
6
5
  require_relative 'dependency_graph/log'
@@ -59,7 +59,7 @@ module Molinillo
59
59
  # @param [Set<Vertex>] vertices the set to add the predecessors to
60
60
  # @return [Set<Vertex>] the vertices of {#graph} where `self` is a
61
61
  # {#descendent?}
62
- def _recursive_predecessors(vertices = Set.new)
62
+ def _recursive_predecessors(vertices = new_vertex_set)
63
63
  incoming_edges.each do |edge|
64
64
  vertex = edge.origin
65
65
  next unless vertices.add?(vertex)
@@ -85,7 +85,7 @@ module Molinillo
85
85
  # @param [Set<Vertex>] vertices the set to add the successors to
86
86
  # @return [Set<Vertex>] the vertices of {#graph} where `self` is an
87
87
  # {#ancestor?}
88
- def _recursive_successors(vertices = Set.new)
88
+ def _recursive_successors(vertices = new_vertex_set)
89
89
  outgoing_edges.each do |edge|
90
90
  vertex = edge.destination
91
91
  next unless vertices.add?(vertex)
@@ -128,7 +128,7 @@ module Molinillo
128
128
 
129
129
  # Is there a path from `self` to `other` following edges in the
130
130
  # dependency graph?
131
- # @return true iff there is a path following edges within this {#graph}
131
+ # @return whether there is a path following edges within this {#graph}
132
132
  def path_to?(other)
133
133
  _path_to?(other)
134
134
  end
@@ -138,7 +138,7 @@ module Molinillo
138
138
  # @param [Vertex] other the vertex to check if there's a path to
139
139
  # @param [Set<Vertex>] visited the vertices of {#graph} that have been visited
140
140
  # @return [Boolean] whether there is a path to `other` from `self`
141
- def _path_to?(other, visited = Set.new)
141
+ def _path_to?(other, visited = new_vertex_set)
142
142
  return false unless visited.add?(self)
143
143
  return true if equal?(other)
144
144
  successors.any? { |v| v._path_to?(other, visited) }
@@ -147,12 +147,18 @@ module Molinillo
147
147
 
148
148
  # Is there a path from `other` to `self` following edges in the
149
149
  # dependency graph?
150
- # @return true iff there is a path following edges within this {#graph}
150
+ # @return whether there is a path following edges within this {#graph}
151
151
  def ancestor?(other)
152
152
  other.path_to?(self)
153
153
  end
154
154
 
155
155
  alias is_reachable_from? ancestor?
156
+
157
+ def new_vertex_set
158
+ require 'set'
159
+ Set.new
160
+ end
161
+ private :new_vertex_set
156
162
  end
157
163
  end
158
164
  end
@@ -34,7 +34,7 @@ module Molinillo
34
34
 
35
35
  # An error caused by attempting to fulfil a dependency that was circular
36
36
  #
37
- # @note This exception will be thrown iff a {Vertex} is added to a
37
+ # @note This exception will be thrown if and only if a {Vertex} is added to a
38
38
  # {DependencyGraph} that has a {DependencyGraph::Vertex#path_to?} an
39
39
  # existing {DependencyGraph::Vertex}
40
40
  class CircularDependencyError < ResolverError
@@ -121,7 +121,7 @@ module Molinillo
121
121
  t = ''.dup
122
122
  depth = 2
123
123
  tree.each do |req|
124
- t << ' ' * depth << req.to_s
124
+ t << ' ' * depth << printable_requirement.call(req)
125
125
  unless tree.last == req
126
126
  if spec = conflict.activated_by_name[name_for(req)]
127
127
  t << %( was resolved to #{version_for_spec.call(spec)}, which)
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Molinillo
4
4
  # The version of Molinillo.
5
- VERSION = '0.7.0'.freeze
5
+ VERSION = '0.8.0'.freeze
6
6
  end
@@ -45,6 +45,17 @@ module Molinillo
45
45
  true
46
46
  end
47
47
 
48
+ # Determines whether two arrays of dependencies are equal, and thus can be
49
+ # grouped.
50
+ #
51
+ # @param [Array<Object>] dependencies
52
+ # @param [Array<Object>] other_dependencies
53
+ # @return [Boolean] whether `dependencies` and `other_dependencies` should
54
+ # be considered equal.
55
+ def dependencies_equal?(dependencies, other_dependencies)
56
+ dependencies == other_dependencies
57
+ end
58
+
48
59
  # Returns the name for the given `dependency`.
49
60
  # @note This method should be 'pure', i.e. the return value should depend
50
61
  # only on the `dependency` parameter.
@@ -329,11 +329,11 @@ module Molinillo
329
329
 
330
330
  # Look for past conflicts that could be unwound to affect the
331
331
  # requirement tree for the current conflict
332
+ all_reqs = last_detail_for_current_unwind.all_requirements
333
+ all_reqs_size = all_reqs.size
332
334
  relevant_unused_unwinds = unused_unwind_options.select do |alternative|
333
- intersecting_requirements =
334
- last_detail_for_current_unwind.all_requirements &
335
- alternative.requirements_unwound_to_instead
336
- next if intersecting_requirements.empty?
335
+ diff_reqs = all_reqs - alternative.requirements_unwound_to_instead
336
+ next if diff_reqs.size == all_reqs_size
337
337
  # Find the highest index unwind whilst looping through
338
338
  current_detail = alternative if alternative > current_detail
339
339
  alternative
@@ -344,8 +344,12 @@ module Molinillo
344
344
  state.unused_unwind_options += unwind_details.reject { |detail| detail.state_index == -1 }
345
345
 
346
346
  # Update the requirements_unwound_to_instead on any relevant unused unwinds
347
- relevant_unused_unwinds.each { |d| d.requirements_unwound_to_instead << current_detail.state_requirement }
348
- unwind_details.each { |d| d.requirements_unwound_to_instead << current_detail.state_requirement }
347
+ relevant_unused_unwinds.each do |d|
348
+ (d.requirements_unwound_to_instead << current_detail.state_requirement).uniq!
349
+ end
350
+ unwind_details.each do |d|
351
+ (d.requirements_unwound_to_instead << current_detail.state_requirement).uniq!
352
+ end
349
353
 
350
354
  current_detail
351
355
  end
@@ -803,7 +807,7 @@ module Molinillo
803
807
 
804
808
  possibilities.reverse_each do |possibility|
805
809
  dependencies = dependencies_for(possibility)
806
- if current_possibility_set && current_possibility_set.dependencies == dependencies
810
+ if current_possibility_set && dependencies_equal?(current_possibility_set.dependencies, dependencies)
807
811
  current_possibility_set.possibilities.unshift(possibility)
808
812
  else
809
813
  possibility_sets.unshift(PossibilitySet.new(dependencies, [possibility]))
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: molinillo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel E. Giddins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-21 00:00:00.000000000 Z
11
+ date: 2021-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.5'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.5'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +67,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
67
  requirements:
82
68
  - - ">="
83
69
  - !ruby/object:Gem::Version
84
- version: 2.0.0
70
+ version: 2.3.0
85
71
  required_rubygems_version: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - ">="