Commit 9a14419b authored by Samuel Giddins's avatar Samuel Giddins

[Resolver] Fix multi-source resolution

parent e9d352d0
......@@ -18,6 +18,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7292](https://github.com/CocoaPods/CocoaPods/pull/7292)
* Fix resolution when multiple sources provide the same pods, and there are
(potential) dependencies between the sources.
[Samuel Giddins](https://github.com/segiddins)
[#7031](https://github.com/CococaPods/CocoaPods/issues/7031)
## 1.4.0.rc.1 (2017-12-16)
##### Enhancements
......
......@@ -351,8 +351,7 @@ module Pod
all_specifications(installation_options.warn_for_multiple_pod_sources).
select { |s| requirement.satisfied_by? s.version }.
map { |s| s.subspec_by_name(dependency.name, false, true) }.
compact.
reverse
compact
end
# @return [Set] Loads or returns a previously initialized set for the Pod
......@@ -508,7 +507,7 @@ module Pod
end,
)
end
raise type, message
raise type.new(message).tap { |e| e.set_backtrace(error.backtrace) }
end
# Returns whether the given spec is platform-compatible with the dependency
......
......@@ -37,12 +37,12 @@ module Pod
end
end
# returns the highest versioned spec last
def all_specifications(warn_for_multiple_pod_sources)
@all_specifications ||= begin
sources_by_version = {}
versions_by_source.each do |source, versions|
versions.each { |v| (sources_by_version[v] ||= []) << source }
sources_by_version
end
if warn_for_multiple_pod_sources
......@@ -56,8 +56,11 @@ module Pod
end
end
versions_by_source.flat_map do |source, versions|
versions.map { |version| LazySpecification.new(name, version, source) }
# sort versions from high to low
sources_by_version.sort_by(&:first).flat_map do |version, sources|
# within each version, we want the prefered (first-specified) source
# to be the _last_ one
sources.reverse_each.map { |source| LazySpecification.new(name, version, source) }
end
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment