Commit 646a24a2 authored by Fabio Pelosin's avatar Fabio Pelosin

[Core Extraction] Adapted Resolver.

parent b0c910b9
...@@ -53,7 +53,7 @@ module Pod ...@@ -53,7 +53,7 @@ module Pod
@update_external_specs = true @update_external_specs = true
@cached_sets = {} @cached_sets = {}
@cached_sources = Source::Aggregate.new @cached_sources = Source::Aggregate.new(config.repos_dir)
end end
# Identifies the specifications that should be installed according whether # Identifies the specifications that should be installed according whether
...@@ -117,11 +117,11 @@ module Pod ...@@ -117,11 +117,11 @@ module Pod
unless @pods_to_install unless @pods_to_install
if lockfile if lockfile
@pods_to_install = specs.select do |spec| @pods_to_install = specs.select do |spec|
spec.version != lockfile.pods_versions[spec.pod_name] spec.version != lockfile.pods_versions[spec.root_spec_name]
end.map(&:name) end.map(&:name)
if update_mode if update_mode
@pods_to_install += specs.select do |spec| @pods_to_install += specs.select do |spec|
spec.version.head? || pods_from_external_sources.include?(spec.pod_name) spec.version.head? || pods_from_external_sources.include?(spec.root_spec_name)
end.map(&:name) end.map(&:name)
end end
@pods_to_install += @pods_by_state[:added] + @pods_by_state[:changed] @pods_to_install += @pods_by_state[:added] + @pods_by_state[:changed]
...@@ -165,7 +165,7 @@ module Pod ...@@ -165,7 +165,7 @@ module Pod
end end
set = Specification::Set::External.new(specification) set = Specification::Set::External.new(specification)
if dependency.subspec_dependency? if dependency.subspec_dependency?
@cached_sets[dependency.top_level_spec_name] ||= set @cached_sets[dependency.root_spec_name] ||= set
end end
set set
else else
...@@ -186,7 +186,7 @@ module Pod ...@@ -186,7 +186,7 @@ module Pod
dependencies.each do |dependency| dependencies.each do |dependency|
# Replace the dependency with a more specific one if the pod is already installed. # Replace the dependency with a more specific one if the pod is already installed.
if !update_mode && @pods_to_lock.include?(dependency.name) if !update_mode && @pods_to_lock.include?(dependency.name)
dependency = lockfile.dependency_for_installed_pod_named(dependency.name) dependency = lockfile.dependency_for_installed_pod_with_root_named(dependency.name)
end end
UI.message("- #{dependency}", '', 2) do UI.message("- #{dependency}", '', 2) do
set = find_cached_set(dependency, target_definition.platform) set = find_cached_set(dependency, target_definition.platform)
...@@ -195,7 +195,7 @@ module Pod ...@@ -195,7 +195,7 @@ module Pod
# Ensure we don't resolve the same spec twice for one target # Ensure we don't resolve the same spec twice for one target
unless @loaded_specs.include?(dependency.name) unless @loaded_specs.include?(dependency.name)
spec = set.specification_by_name(dependency.name) spec = set.specification_by_name(dependency.name)
@pods_from_external_sources << spec.pod_name if dependency.external? @pods_from_external_sources << spec.root_spec_name if dependency.external?
@loaded_specs << spec.name @loaded_specs << spec.name
@cached_specs[spec.name] = spec @cached_specs[spec.name] = spec
# Configure the specification # Configure the specification
......
...@@ -44,13 +44,13 @@ module Pod ...@@ -44,13 +44,13 @@ module Pod
set.stub_platform = :ios set.stub_platform = :ios
lambda { @resolver.resolve }.should.not.raise lambda { @resolver.resolve }.should.not.raise
set.stub_platform = :osx set.stub_platform = :osx
lambda { @resolver.resolve }.should.raise Informative lambda { @resolver.resolve }.should.raise Pod::StandardError
@podfile.platform :osx @podfile.platform :osx
set.stub_platform = :osx set.stub_platform = :osx
lambda { @resolver.resolve }.should.not.raise lambda { @resolver.resolve }.should.not.raise
set.stub_platform = :ios set.stub_platform = :ios
lambda { @resolver.resolve }.should.raise Informative lambda { @resolver.resolve }.should.raise Pod::StandardError
end end
it "raises once any of the dependencies does not have a deployment_target compatible with its podfile target" do it "raises once any of the dependencies does not have a deployment_target compatible with its podfile target" do
...@@ -62,7 +62,7 @@ module Pod ...@@ -62,7 +62,7 @@ module Pod
lambda { @resolver.resolve }.should.not.raise lambda { @resolver.resolve }.should.not.raise
Specification.any_instance.stubs(:available_platforms).returns([ Platform.new(:ios, '5.0'), Platform.new(:osx, '10.7') ]) Specification.any_instance.stubs(:available_platforms).returns([ Platform.new(:ios, '5.0'), Platform.new(:osx, '10.7') ])
lambda { @resolver.resolve }.should.raise Informative lambda { @resolver.resolve }.should.raise Pod::StandardError
end end
it "resolves subspecs" do it "resolves subspecs" do
...@@ -110,7 +110,7 @@ module Pod ...@@ -110,7 +110,7 @@ module Pod
} }
end end
it "it includes only the main subspec of a specification node" do xit "it includes only the main subspec of a specification node" do
@podfile = Podfile.new do @podfile = Podfile.new do
platform :ios platform :ios
pod do |s| pod do |s|
...@@ -200,7 +200,7 @@ module Pod ...@@ -200,7 +200,7 @@ module Pod
pod 'JSONKit', "1.5pre" pod 'JSONKit', "1.5pre"
end end
resolver = Resolver.new(podfile, nil, stub('sandbox')) resolver = Resolver.new(podfile, nil, stub('sandbox'))
lambda {resolver.resolve}.should.raise Informative lambda {resolver.resolve}.should.raise Pod::StandardError
end end
describe "Concerning Installation mode" do describe "Concerning Installation mode" 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