Commit 6c75b654 authored by Fabio Pelosin's avatar Fabio Pelosin

[Resolver] Support for deployment target check.

parent 8553b9eb
...@@ -84,11 +84,8 @@ module Pod ...@@ -84,11 +84,8 @@ module Pod
end end
def validate_platform!(spec, target) def validate_platform!(spec, target)
unless target.platform.support?(spec.platform) unless spec.platforms.any? { |platform| target.platform.support?(platform) }
raise Informative, "[!] The platform required by the target `#{target.name}' `#{target.platform}' does not match that of #{spec} `#{spec.platform}'".red raise Informative, "[!] The platform of the target `#{target.name}' (#{target.platform}) is not compatible with `#{spec}' which has a minimun requirement of #{spec.platforms.join(' - ')}.".red
end
unless !target.platform.deployment_target || !spec.deployment_target[platform.name] || spec.deployment_target[platform.name].satisfied_by?(target.platform.deployment_target)
raise Informative, "[!] The platform required by the target `#{target.name}' `#{target.platform}' does not match that of `#{spec}' `#{spec.platform} #{spec.deployment_target[platform.name]}'".magenta
end end
end end
end end
......
...@@ -39,7 +39,7 @@ describe "Pod::Resolver" do ...@@ -39,7 +39,7 @@ describe "Pod::Resolver" do
lambda { @resolver.resolve }.should.not.raise lambda { @resolver.resolve }.should.not.raise
end end
it "raises once any of the dependencies does not match the platform of the root spec (Podfile)" do it "raises once any of the dependencies does not match the platform of its podfile target" do
set = Pod::Spec::Set.new(config.repos_dir + 'master/ASIHTTPRequest') set = Pod::Spec::Set.new(config.repos_dir + 'master/ASIHTTPRequest')
@resolver.cached_sets['ASIHTTPRequest'] = set @resolver.cached_sets['ASIHTTPRequest'] = set
...@@ -59,27 +59,15 @@ describe "Pod::Resolver" do ...@@ -59,27 +59,15 @@ describe "Pod::Resolver" do
lambda { @resolver.resolve }.should.raise Pod::Informative lambda { @resolver.resolve }.should.raise Pod::Informative
end end
it "does not raise if all of the dependencies have a deployment target equal or lower of the root spec (Podfile)" do it "raises once any of the dependencies does not have a deployment_target compatible with its podfile target" do
set = Pod::Spec::Set.new(config.repos_dir + 'master/ASIHTTPRequest') set = Pod::Spec::Set.new(config.repos_dir + 'master/ASIHTTPRequest')
@resolver.cached_sets['ASIHTTPRequest'] = set @resolver.cached_sets['ASIHTTPRequest'] = set
@podfile.platform :ios, "4.0"
def set.stub_platform=(platform); @stubbed_platform = platform; end Pod::Specification.any_instance.stubs(:platforms).returns([ Pod::Platform.new(:ios, '4.0'), Pod::Platform.new(:osx, '10.7') ])
def set.specification; spec = super; spec.platform = @stubbed_platform; spec; end
@podfile.platform :ios, { :deployment_target => "4.0.0" }
set.stub_platform = :ios, { :deployment_target => "4.0.0" }
lambda { @resolver.resolve }.should.not.raise lambda { @resolver.resolve }.should.not.raise
end
it "raises once any of the dependencies requires a higher deployment target of the root spec (Podfile)" do
set = Pod::Spec::Set.new(config.repos_dir + 'master/ASIHTTPRequest')
@resolver.cached_sets['ASIHTTPRequest'] = set
def set.stub_platform=(platform); @stubbed_platform = platform; end
def set.specification; spec = super; spec.platform = @stubbed_platform; spec; end
@podfile.platform :ios, { :deployment_target => "4.0.0" } Pod::Specification.any_instance.stubs(:platforms).returns([ Pod::Platform.new(:ios, '5.0'), Pod::Platform.new(:osx, '10.7') ])
set.stub_platform = :ios, { :deployment_target => "5.0.0" }
lambda { @resolver.resolve }.should.raise Pod::Informative lambda { @resolver.resolve }.should.raise Pod::Informative
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