Commit 61ddc073 authored by Fabio Pelosin's avatar Fabio Pelosin

[Installer] Define deployment target of the Pods project.

Closes #556
parent b2bb2869
......@@ -5,6 +5,8 @@
* CocoaPods now defines the `COCOAPODS=1` macro in the Pod and the Client
targets. This is useful for libraries which conditionally expose interfaces.
[#903](https://github.com/CocoaPods/CocoaPods/issues/903)
* CocoaPods now defines the deployment target of the project.
[#556](https://github.com/CocoaPods/CocoaPods/issues/556)
###### Bug fixes
......
......@@ -276,6 +276,13 @@ module Pod
@pods_project.add_podfile(config.podfile_path)
end
sandbox.project = @pods_project
platforms = libraries.map(&:platform)
osx_deployment_target = platforms.select { |p| p.name == :osx }.map(&:deployment_target).min
ios_deployment_target = platforms.select { |p| p.name == :ios }.map(&:deployment_target).min
@pods_project.build_configurations.each do |build_configuration|
build_configuration.build_settings['MACOSX_DEPLOYMENT_TARGET'] = osx_deployment_target.to_s if osx_deployment_target
build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = ios_deployment_target.to_s if ios_deployment_target
end
end
end
......
......@@ -96,6 +96,8 @@ Targets:
Build Configurations:
- Release:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
- Debug:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
......@@ -163,6 +163,8 @@ Targets:
Build Configurations:
- Release:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
- Debug:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
......@@ -96,6 +96,8 @@ Targets:
Build Configurations:
- Release:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '4.3'
- Debug:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '4.3'
......@@ -91,6 +91,8 @@ Targets:
Build Configurations:
- Release:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '4.3'
- Debug:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '4.3'
......@@ -240,6 +240,8 @@ Targets:
Build Configurations:
- Release:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
- Debug:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
......@@ -91,6 +91,8 @@ Targets:
Build Configurations:
- Release:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
- Debug:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
......@@ -93,6 +93,8 @@ Targets:
Build Configurations:
- Release:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
- Debug:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
......@@ -91,6 +91,8 @@ Targets:
Build Configurations:
- Release:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
- Debug:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
......@@ -91,6 +91,8 @@ Targets:
Build Configurations:
- Release:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
- Debug:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
......@@ -95,6 +95,8 @@ Targets:
Build Configurations:
- Release:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
- Debug:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
......@@ -170,6 +170,10 @@ Targets:
Build Configurations:
- Release:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '4.3'
MACOSX_DEPLOYMENT_TARGET: '10.6'
- Debug:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '4.3'
MACOSX_DEPLOYMENT_TARGET: '10.6'
......@@ -91,6 +91,8 @@ Targets:
Build Configurations:
- Release:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
- Debug:
Build Settings: {}
Build Settings:
IPHONEOS_DEPLOYMENT_TARGET: '6.0'
......@@ -205,16 +205,32 @@ module Pod
describe "#prepare_pods_project" do
it "creates the Pods project" do
@installer.stubs(:libraries).returns([])
@installer.send(:prepare_pods_project)
@installer.pods_project.class.should == Pod::Project
end
it "adds the Podfile to the Pods project" do
@installer.stubs(:libraries).returns([])
config.podfile_path.stubs(:exist?).returns(true)
@installer.send(:prepare_pods_project)
f = @installer.pods_project['Podfile']
f.name.should == 'Podfile'
end
it "sets the deployment target for the whole project" do
library_ios = Library.new(nil)
library_osx = Library.new(nil)
library_ios.platform = Platform.new(:ios, '6.0')
library_osx.platform = Platform.new(:osx, '10.8')
@installer.stubs(:libraries).returns([library_ios, library_osx])
@installer.send(:prepare_pods_project)
build_settings = @installer.pods_project.build_configurations.map(&:build_settings)
build_settings.should == [
{"MACOSX_DEPLOYMENT_TARGET"=>"10.8", "IPHONEOS_DEPLOYMENT_TARGET"=>"6.0"},
{"MACOSX_DEPLOYMENT_TARGET"=>"10.8", "IPHONEOS_DEPLOYMENT_TARGET"=>"6.0"},
]
end
end
#--------------------------------------#
......@@ -259,20 +275,22 @@ module Pod
describe "#write_pod_project" do
it "sorts the main group" do
before do
@installer.stubs(:libraries).returns([])
@installer.send(:prepare_pods_project)
end
it "sorts the main group" do
@installer.pods_project.main_group.expects(:sort_by_type!)
@installer.send(:write_pod_project)
end
it "sorts the frameworks group" do
@installer.send(:prepare_pods_project)
@installer.pods_project['Frameworks'].expects(:sort_by_type!)
@installer.send(:write_pod_project)
end
it "saves the project to the given path" do
@installer.send(:prepare_pods_project)
path = temporary_directory + 'Pods/Pods.xcodeproj'
@installer.pods_project.expects(:save_as).with(path)
@installer.send(:write_pod_project)
......
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