Commit e1f19d7d authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Resolver] Ensure Informative errors are always shown for platform incompatibilities

Closes https://github.com/CocoaPods/CocoaPods/issues/2868
parent d346525c
......@@ -50,7 +50,7 @@ module Pod
# definition.
#
def resolve
dependencies = @podfile.target_definition_list.map(&:dependencies).flatten
dependencies = podfile.target_definition_list.map(&:dependencies).flatten
@cached_sets = {}
@activated = Molinillo::Resolver.new(self, self).resolve(dependencies, locked_dependencies)
specs_by_target
......@@ -78,7 +78,6 @@ module Pod
uniq.
sort_by(&:name).
each do |spec|
validate_platform(spec, target)
sandbox.store_head_pod(spec.name) if spec.version.head?
end
end
......@@ -408,6 +407,7 @@ module Pod
# dependencies for `target`.
#
def valid_dependencies_for_target_from_node(target, node)
validate_platform(node.payload, target)
dependency_nodes = node.outgoing_edges.select do |edge|
edge_is_valid_for_target?(edge, target)
end.map(&:destination)
......
......@@ -175,6 +175,17 @@ module Pod
e.message.should.match(/platform .* not compatible/)
end
it 'raises when a resolved dependency has a platform incompatibility' do
@podfile = Podfile.new do
platform :osx, '10.7'
pod 'ReactiveCocoa', '0.16.1' # this version is iOS-only
end
@resolver.stubs(:podfile).returns(@podfile)
should.raise Informative do
@resolver.resolve
end.message.should.match /platform .* not compatible/
end
it 'raises if unable to find a specification' do
Specification.any_instance.stubs(:all_dependencies).returns([Dependency.new('Windows')])
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