Commit c09b079d authored by Samuel Giddins's avatar Samuel Giddins

[Resolver] Sort external source dependencies first

This resolves a (potential) ordering bug due to pre-releases.

In #possibility_versions_for_root_name, we check whether dependencies on a pod are pre-release or external source, and if so allow pre-releases. It is crucial, therefore, that any external source dependencies have been addressed before any transitive source without the external source, so that pre-releases are (properly) allowed.
parent ec89a4e3
......@@ -261,6 +261,7 @@ module Pod
name = name_for(dependency)
[
activated.vertex_named(name).payload ? 0 : 1,
dependency.external_source ? 0 : 1,
dependency.prerelease? ? 0 : 1,
conflicts[name] ? 0 : 1,
search_for(dependency).count,
......
......@@ -1019,6 +1019,29 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
specs = resolver.resolve.values.flatten.map(&:spec).map(&:to_s).sort
specs.should == ['PrereleaseMonkey (1.0-beta1)']
end
it 'resolves when there is no prerelease dependency on an external source pod' do
sandbox = config.sandbox
local_pod = Specification.from_hash('name' => 'LocalPod', 'version' => '1.0.0.LOCAL')
local_pod2 = Specification.from_hash('name' => 'LocalPod2', 'version' => '1.0.0.LOCAL', 'dependencies' => { 'LocalPod' => [] })
sandbox.stubs(:specification).with('LocalPod').returns(local_pod)
sandbox.stubs(:specification).with('LocalPod2').returns(local_pod2)
podfile = Podfile.new do
target 'SampleProject' do
platform :ios, '9.0'
pod 'LocalPod', :path => '../'
pod 'LocalPod2', :path => '../'
end
end
locked_graph = dependency_graph_from_array([
Dependency.new('LocalPod', '= 1.0.0.LOCAL'),
Dependency.new('LocalPod2', '= 1.0.0.LOCAL'),
])
resolver = Resolver.new(config.sandbox, podfile, locked_graph, config.sources_manager.all)
specs = resolver.resolve.values.flatten.map(&:spec).map(&:to_s).sort
specs.should == ['LocalPod (1.0.0.LOCAL)', 'LocalPod2 (1.0.0.LOCAL)']
end
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