[Resolver] Fix local pod platform conflict error

When resolver fails because of platform deployment target for a local pod,
`possibility` value is non-nil. We use this to discriminate this error type with
conflict caused by a change in dependencies of the local pod.
parent 048955d3
...@@ -389,7 +389,6 @@ module Pod ...@@ -389,7 +389,6 @@ module Pod
error.conflicts.each do |name, conflict| error.conflicts.each do |name, conflict|
local_pod_parent = conflict.requirement_trees.flatten.reverse.find(&:local?) local_pod_parent = conflict.requirement_trees.flatten.reverse.find(&:local?)
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
message = '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}`, " \
...@@ -398,7 +397,7 @@ module Pod ...@@ -398,7 +397,7 @@ module Pod
'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 local_pod_parent && !specifications_for_dependency(conflict.requirement).empty? elsif local_pod_parent && !specifications_for_dependency(conflict.requirement).empty? && !conflict.possibility
# Conflict was caused by a requirement from a local dependency. # Conflict was caused by a requirement from a local dependency.
# Tell user to use `pod update`. # Tell user to use `pod update`.
message << "\n\nIt seems like you've changed the constraints of dependency `#{name}` " \ message << "\n\nIt seems like you've changed the constraints of dependency `#{name}` " \
......
...@@ -225,6 +225,21 @@ module Pod ...@@ -225,6 +225,21 @@ module Pod
message.should.match /required a higher minimum deployment target/ message.should.match /required a higher minimum deployment target/
end end
it 'raises an informative error when version conflict is caused by platform incompatibilities for local pods' do
sandbox = config.sandbox
local_spec = Specification.from_hash('name' => 'LocalPod', 'version' => '1.0', 'platforms' => { 'ios' => '8.0' })
sandbox.stubs(:specification).with('LocalPod').returns(local_spec)
@podfile = Podfile.new do
target 'SampleProject' do
platform :ios, '7.0'
pod 'LocalPod', :path => '../'
end
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