Commit 3198bde0 authored by Samuel Giddins's avatar Samuel Giddins

[PodTarget] Ensure the deployment target is high enough for frameworks

parent 61b3669d
...@@ -380,6 +380,7 @@ module Pod ...@@ -380,6 +380,7 @@ module Pod
aggregate_targets.each do |aggregate_target| aggregate_targets.each do |aggregate_target|
aggregate_target.pod_targets.each do |pod_target| aggregate_target.pod_targets.each do |pod_target|
pod_target.host_requires_frameworks ||= aggregate_target.requires_frameworks? pod_target.host_requires_frameworks ||= aggregate_target.requires_frameworks?
pod_target.platform = nil # needs to be recomputed
end end
end end
end end
......
...@@ -325,18 +325,6 @@ module Pod ...@@ -325,18 +325,6 @@ module Pod
end end
end end
# The deployment target for the pod target, which is the maximum of all
# the deployment targets for the current platform of the target.
#
# @return [String] The deployment target.
#
def deployment_target
default = Podfile::TargetDefinition::PLATFORM_DEFAULTS[target.platform.name]
target.specs.map do |spec|
Pod::Version.new(spec.deployment_target(target.platform.name) || default)
end.max.to_s
end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
end end
end end
......
...@@ -88,12 +88,30 @@ module Pod ...@@ -88,12 +88,30 @@ module Pod
end end
end end
# @return [Platform] the platform for this target. # The deployment target for the pod target, which is the maximum of all
# the deployment targets for the current platform of the target.
#
# @return [String] The deployment target.
# #
def platform def platform
@platform ||= target_definitions.first.platform @platform ||= begin
platform_name = target_definitions.first.platform.name
default = Podfile::TargetDefinition::PLATFORM_DEFAULTS[platform_name]
deployment_target = specs.map do |spec|
version = Pod::Version.new(spec.deployment_target(platform_name) || default)
if platform_name == :ios && requires_frameworks?
minimum = Version.new('8.0')
version = [version, minimum].max
end
version
end.max
Platform.new(platform_name, deployment_target)
end
end end
# @visibility private
attr_writer :platform
# @return [Podfile] The podfile which declares the dependency. # @return [Podfile] The podfile which declares the dependency.
# #
def podfile def podfile
......
...@@ -364,8 +364,16 @@ module Pod ...@@ -364,8 +364,16 @@ module Pod
Config.instance = @original_config Config.instance = @original_config
end end
def download_pod def deployment_target
deployment_target = spec.subspec_by_name(subspec_name).deployment_target(consumer.platform_name) deployment_target = spec.subspec_by_name(subspec_name).deployment_target(consumer.platform_name)
if consumer.platform_name == :ios && use_frameworks
minimum = Version.new('8.0')
deployment_target = [Version.new(deployment_target), minimum].max.to_s
end
deployment_target
end
def download_pod
podfile = podfile_from_spec(consumer.platform_name, deployment_target, use_frameworks) podfile = podfile_from_spec(consumer.platform_name, deployment_target, use_frameworks)
sandbox = Sandbox.new(config.sandbox_root) sandbox = Sandbox.new(config.sandbox_root)
@installer = Installer.new(sandbox, podfile) @installer = Installer.new(sandbox, podfile)
...@@ -376,7 +384,6 @@ module Pod ...@@ -376,7 +384,6 @@ module Pod
def create_app_project def create_app_project
app_project = Xcodeproj::Project.new(validation_dir + 'App.xcodeproj') app_project = Xcodeproj::Project.new(validation_dir + 'App.xcodeproj')
deployment_target = spec.subspec_by_name(subspec_name).deployment_target(consumer.platform_name)
app_project.new_target(:application, 'App', consumer.platform_name, deployment_target) app_project.new_target(:application, 'App', consumer.platform_name, deployment_target)
app_project.save app_project.save
app_project.recreate_user_schemes app_project.recreate_user_schemes
......
...@@ -49,8 +49,17 @@ module Pod ...@@ -49,8 +49,17 @@ module Pod
target.build_settings('Debug')['IPHONEOS_DEPLOYMENT_TARGET'].should == '4.3' target.build_settings('Debug')['IPHONEOS_DEPLOYMENT_TARGET'].should == '4.3'
end end
it 'sets the platform and the deployment target for iOS targets that require frameworks' do
@pod_target.stubs(:requires_frameworks?).returns(true)
@installer.install!
target = @project.targets.first
target.platform_name.should == :ios
target.deployment_target.should == '8.0'
target.build_settings('Debug')['IPHONEOS_DEPLOYMENT_TARGET'].should == '8.0'
end
it 'sets the platform and the deployment target for OS X targets' do it 'sets the platform and the deployment target for OS X targets' do
@pod_target.stubs(:platform).returns(Platform.new(:osx, '10.8')) @pod_target.target_definitions.first.stubs(:platform).returns(Platform.new(:osx, '10.8'))
@installer.install! @installer.install!
target = @project.targets.first target = @project.targets.first
target.platform_name.should == :osx target.platform_name.should == :osx
......
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