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

Merge pull request #4537 from CocoaPods/seg-deployment-target-8-frameworks

[PodTarget] Ensure the deployment target is high enough for frameworks
parents 61b3669d afff8ebb
...@@ -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
......
...@@ -35,7 +35,7 @@ module Pod ...@@ -35,7 +35,7 @@ module Pod
# root with the `${PODS_ROOT}` variable. # root with the `${PODS_ROOT}` variable.
# #
def search_paths(platform) def search_paths(platform)
platform_search_paths = @search_paths.select { |entry| entry[:platform] == platform } platform_search_paths = @search_paths.select { |entry| entry[:platform] == platform.name }
headers_dir = root.relative_path_from(sandbox.root).dirname headers_dir = root.relative_path_from(sandbox.root).dirname
["${PODS_ROOT}/#{headers_dir}/#{@relative_path}"] + platform_search_paths.uniq.map { |entry| "${PODS_ROOT}/#{headers_dir}/#{entry[:path]}" } ["${PODS_ROOT}/#{headers_dir}/#{@relative_path}"] + platform_search_paths.uniq.map { |entry| "${PODS_ROOT}/#{headers_dir}/#{entry[:path]}" }
...@@ -117,7 +117,7 @@ module Pod ...@@ -117,7 +117,7 @@ module Pod
# @return [void] # @return [void]
# #
def add_search_path(path, platform) def add_search_path(path, platform)
@search_paths << { :platform => platform, :path => (Pathname.new(@relative_path) + path) } @search_paths << { :platform => platform.name, :path => (Pathname.new(@relative_path) + path) }
end end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
......
...@@ -88,12 +88,32 @@ module Pod ...@@ -88,12 +88,32 @@ module Pod
end end
end end
# @note The deployment target for the pod target is the maximum of all
# the deployment targets for the current platform of the target
# (or the minimum required to support the current installation
# strategy, if higher).
#
# @return [Platform] the platform for this target. # @return [Platform] the platform for this 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.new(spec.deployment_target(platform_name) || default)
end.max
if platform_name == :ios && requires_frameworks?
minimum = Version.new('8.0')
deployment_target = [deployment_target, minimum].max
end
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
......
Subproject commit 565dd11d9ad810cf7665f1c5830eb5a1305c7e45 Subproject commit 071e796206f4908dd57d06db496560d667c4020f
...@@ -139,7 +139,7 @@ module Pod ...@@ -139,7 +139,7 @@ module Pod
end end
it 'validates specs as frameworks by default' do it 'validates specs as frameworks by default' do
Validator.any_instance.expects(:podfile_from_spec).with(:ios, nil, true).times(3) Validator.any_instance.expects(:podfile_from_spec).with(:ios, '8.0', true).times(3)
Validator.any_instance.expects(:podfile_from_spec).with(:osx, nil, true).twice Validator.any_instance.expects(:podfile_from_spec).with(:osx, nil, true).twice
Validator.any_instance.expects(:podfile_from_spec).with(:watchos, nil, true).twice Validator.any_instance.expects(:podfile_from_spec).with(:watchos, nil, true).twice
Validator.any_instance.expects(:podfile_from_spec).with(:tvos, nil, true).twice Validator.any_instance.expects(:podfile_from_spec).with(:tvos, nil, true).twice
......
...@@ -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
......
...@@ -47,9 +47,9 @@ module Pod ...@@ -47,9 +47,9 @@ module Pod
end end
it 'only exposes header search paths for the given platform' do it 'only exposes header search paths for the given platform' do
@header_dir.add_search_path('iOS Search Path', :ios) @header_dir.add_search_path('iOS Search Path', Platform.ios)
@header_dir.add_search_path('OS X Search Path', :osx) @header_dir.add_search_path('OS X Search Path', Platform.osx)
@header_dir.search_paths(:ios).sort.should == [ @header_dir.search_paths(Platform.ios).sort.should == [
'${PODS_ROOT}/Headers/Public', '${PODS_ROOT}/Headers/Public',
'${PODS_ROOT}/Headers/Public/iOS Search Path', '${PODS_ROOT}/Headers/Public/iOS Search Path',
] ]
......
...@@ -690,7 +690,7 @@ module Pod ...@@ -690,7 +690,7 @@ module Pod
setup_validator setup_validator
@validator.expects(:podfile_from_spec).with(:osx, nil, true).once @validator.expects(:podfile_from_spec).with(:osx, nil, true).once
@validator.expects(:podfile_from_spec).with(:ios, nil, true).once @validator.expects(:podfile_from_spec).with(:ios, '8.0', true).once
@validator.expects(:podfile_from_spec).with(:tvos, nil, true).once @validator.expects(:podfile_from_spec).with(:tvos, nil, true).once
@validator.expects(:podfile_from_spec).with(:watchos, nil, true).once @validator.expects(:podfile_from_spec).with(:watchos, nil, true).once
@validator.send(:perform_extensive_analysis, @validator.spec) @validator.send(:perform_extensive_analysis, @validator.spec)
......
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