Commit 9e796e48 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #3953 from CocoaPods/seg-version-conflict-deployment-target

[Resolver] Make the version conflict message explain when deployment …
parents 82edf681 0c256275
...@@ -22,6 +22,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -22,6 +22,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
[#3764](https://github.com/CocoaPods/CocoaPods/issues/3764) [#3764](https://github.com/CocoaPods/CocoaPods/issues/3764)
* The resolver error message when a conflict occurred due to platform deployment
target mismatches will now explain that.
[Samuel Giddins](https://github.com/segiddins)
[#3926](https://github.com/CocoaPods/CocoaPods/issues/3926)
## 0.38.2 ## 0.38.2
......
...@@ -370,22 +370,30 @@ module Pod ...@@ -370,22 +370,30 @@ module Pod
# @param [Molinillo::ResolverError] error # @param [Molinillo::ResolverError] error
# #
def handle_resolver_error(error) def handle_resolver_error(error)
message = error.message
case error case error
when Molinillo::VersionConflict when Molinillo::VersionConflict
error.conflicts.each do |name, conflict| error.conflicts.each do |name, conflict|
lockfile_reqs = conflict.requirements[name_for_locking_dependency_source] lockfile_reqs = conflict.requirements[name_for_locking_dependency_source]
if lockfile_reqs && lockfile_reqs.last && lockfile_reqs.last.prerelease? && !conflict.existing if lockfile_reqs && lockfile_reqs.last && lockfile_reqs.last.prerelease? && !conflict.existing
raise Informative, 'Due to the previous naïve CocoaPods resolver, ' \ message = 'Due to the previous naïve CocoaPods resolver, ' \
"you were using a pre-release version of `#{name}`, " \ "you were using a pre-release version of `#{name}`, " \
'without explicitly asking for a pre-release version, which now leads to a conflict. ' \ 'without explicitly asking for a pre-release version, which now leads to a conflict. ' \
'Please decide to either use that pre-release version by adding the ' \ 'Please decide to either use that pre-release version by adding the ' \
'version requirement to your Podfile ' \ 'version requirement to your Podfile ' \
"(e.g. `pod '#{name}', '#{lockfile_reqs.map(&:requirement).join("', '")}'`) " \ "(e.g. `pod '#{name}', '#{lockfile_reqs.map(&:requirement).join("', '")}'`) " \
"or revert to a stable version by running `pod update #{name}`." "or revert to a stable version by running `pod update #{name}`."
elsif !conflict.existing
conflict.requirements.values.flatten.each do |r|
unless search_for(r).empty?
message << "\n\nSpecs satisfying the `#{r}` dependency were found, " \
'but they required a higher minimum deployment target.'
end
end
end end
end end
end end
raise Informative, error.message raise Informative, message
end end
# Returns whether the given spec is platform-compatible with the dependency # Returns whether the given spec is platform-compatible with the dependency
......
...@@ -191,6 +191,16 @@ module Pod ...@@ -191,6 +191,16 @@ module Pod
] ]
end end
it 'raises an informative error when version conflicts are caused by platform incompatibilities' do
@podfile = Podfile.new do
platform :osx, '10.7'
pod 'AFNetworking', '2.0.0' # requires 10.8
end
@resolver.stubs(:podfile).returns(@podfile)
message = should.raise(Informative) { @resolver.resolve }.message
message.should.match /required a higher minimum deployment target/
end
it 'raises if unable to find a specification' do it 'raises if unable to find a specification' do
Specification.any_instance.stubs(:all_dependencies).returns([Dependency.new('Windows')]) Specification.any_instance.stubs(:all_dependencies).returns([Dependency.new('Windows')])
message = should.raise Informative do message = should.raise Informative do
......
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