Commit 81d3550d authored by Eloy Duran's avatar Eloy Duran

Actually add the user's build configurations to Pods.xcodeproj.

Closes #105, #121, #215.
parent a0a15ccc
...@@ -19,7 +19,7 @@ link_with ['MyAppTarget', 'MyOtherAppTarget'] ...@@ -19,7 +19,7 @@ link_with ['MyAppTarget', 'MyOtherAppTarget']
dependency 'JSONKit' dependency 'JSONKit'
target :test, :exclusive => true do target :test, :exclusive => true do
xcodeproj 'TestProject' xcodeproj 'TestProject', 'Test' => :debug
link_with 'TestRunnerTarget' link_with 'TestRunnerTarget'
dependency 'Kiwi' dependency 'Kiwi'
end end
...@@ -42,6 +42,16 @@ need to specify the target to link with. ...@@ -42,6 +42,16 @@ need to specify the target to link with.
See [#76](https://github.com/CocoaPods/CocoaPods/issues/76) for more info. See [#76](https://github.com/CocoaPods/CocoaPods/issues/76) for more info.
Finally, CocoaPods will add build configurations to the Pods project for all
configurations in the other projects in the workspace. By default the
configurations are based on the `Release` configuration, to base them on the
`Debug` configuration you will have to explicitely specify them as can be seen
above in the following line:
```ruby
xcodeproj 'TestProject', 'Test' => :debug
```
### Documentation ### Documentation
......
...@@ -25,6 +25,7 @@ module Pod ...@@ -25,6 +25,7 @@ module Pod
def project def project
return @project if @project return @project if @project
@project = Pod::Project.new @project = Pod::Project.new
@project.user_build_configurations = @podfile.user_build_configurations
activated_pods.each do |pod| activated_pods.each do |pod|
# Add all source files to the project grouped by pod # Add all source files to the project grouped by pod
group = @project.add_pod_group(pod.name) group = @project.add_pod_group(pod.name)
......
...@@ -29,7 +29,7 @@ module Pod ...@@ -29,7 +29,7 @@ module Pod
end end
def project def project
Xcodeproj::Project.new(path) if path Xcodeproj::Project.new(path) if path && path.exist?
end end
def build_configurations def build_configurations
......
...@@ -32,7 +32,13 @@ describe Pod::Installer::TargetInstaller do ...@@ -32,7 +32,13 @@ describe Pod::Installer::TargetInstaller do
@project.targets.count.should == 1 @project.targets.count.should == 1
@project.targets.first.name.should == @target_definition.label @project.targets.first.name.should == @target_definition.label
end end
it "adds the user's build configurations to the target" do
@project.user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug }
do_install!
@project.targets.first.build_configurations.map(&:name).sort.should == %w{ AppStore Debug Release Test }
end
it 'adds each pod to the static library target' do it 'adds each pod to the static library target' do
@pods[0].expects(:add_to_target).with(instance_of(Xcodeproj::Project::Object::PBXNativeTarget)) @pods[0].expects(:add_to_target).with(instance_of(Xcodeproj::Project::Object::PBXNativeTarget))
do_install! do_install!
...@@ -48,7 +54,6 @@ describe Pod::Installer::TargetInstaller do ...@@ -48,7 +54,6 @@ describe Pod::Installer::TargetInstaller do
@installer.xcconfig.to_hash['HEADER_SEARCH_PATHS'].should.include("\"#{@sandbox.header_search_paths.join('" "')}\"") @installer.xcconfig.to_hash['HEADER_SEARCH_PATHS'].should.include("\"#{@sandbox.header_search_paths.join('" "')}\"")
end end
it 'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it' do it 'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it' do
do_install! do_install!
@installer.xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.not.include("-fobjc-arc") @installer.xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.not.include("-fobjc-arc")
......
...@@ -15,11 +15,12 @@ describe "Pod::Installer" do ...@@ -15,11 +15,12 @@ describe "Pod::Installer" do
describe ", by default," do describe ", by default," do
before do before do
@xcconfig = Pod::Installer.new(Pod::Podfile.new do podfile = Pod::Podfile.new do
platform :ios platform :ios
xcodeproj 'MyProject' xcodeproj 'MyProject'
dependency 'JSONKit' dependency 'JSONKit'
end).target_installers.first.xcconfig.to_hash end
@xcconfig = Pod::Installer.new(podfile).target_installers.first.xcconfig.to_hash
end end
it "sets the header search paths where installed Pod headers can be found" do it "sets the header search paths where installed Pod headers can be found" do
...@@ -59,4 +60,14 @@ describe "Pod::Installer" do ...@@ -59,4 +60,14 @@ describe "Pod::Installer" do
installer = Pod::Installer.new(podfile) installer = Pod::Installer.new(podfile)
installer.target_installers.map(&:target_definition).map(&:name).should == [:not_empty] installer.target_installers.map(&:target_definition).map(&:name).should == [:not_empty]
end end
it "adds the user's build configurations" do
path = fixture('SampleProject/SampleProject.xcodeproj')
podfile = Pod::Podfile.new do
platform :ios
xcodeproj path, 'App Store' => :release
end
installer = Pod::Installer.new(podfile)
installer.project.build_configurations.map(&:name).sort.should == ['App Store', 'Debug', 'Release', 'Test']
end
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