Commit a0a15ccc authored by Eloy Duran's avatar Eloy Duran

Add build configurations to the Pods targets based on Debug and Release.

parent c46a4c1b
...@@ -15,10 +15,14 @@ module Pod ...@@ -15,10 +15,14 @@ module Pod
def initialize(*) def initialize(*)
super super
main_group << groups.new('name' => 'Pods') main_group << groups.new('name' => 'Pods')
@user_build_configurations = []
end end
def add_build_configurations(user_configurations) def user_build_configurations=(user_build_configurations)
user_configurations.each do |name, _| @user_build_configurations = user_build_configurations
# The configurations at the top level only need to exist, they don't hold
# any build settings themselves, that's left to `add_pod_target`.
user_build_configurations.each do |name, _|
unless build_configurations.map(&:name).include?(name) unless build_configurations.map(&:name).include?(name)
build_configurations.new('name' => name) build_configurations.new('name' => name)
end end
...@@ -49,6 +53,14 @@ module Pod ...@@ -49,6 +53,14 @@ module Pod
target.build_settings('Debug').merge!(settings) target.build_settings('Debug').merge!(settings)
target.build_settings('Release').merge!(settings) target.build_settings('Release').merge!(settings)
@user_build_configurations.each do |name, type|
unless target.build_configurations.map(&:name).include?(name)
config = target.build_configurations.new('name' => name)
# Copy the settings from either the Debug or the Release configuration.
config.build_settings = target.build_settings(type.to_s.capitalize).merge(settings)
end
end
target target
end end
end end
......
...@@ -34,10 +34,17 @@ describe 'Pod::Project' do ...@@ -34,10 +34,17 @@ describe 'Pod::Project' do
end end
it "adds build configurations named after every configuration across all of the user's projects" do it "adds build configurations named after every configuration across all of the user's projects" do
@project.add_build_configurations('Debug' => :debug, 'Release' => :release, 'Test' => :debug, 'AppStore' => :release) @project.user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'Test' => :debug, 'AppStore' => :release }
@project.build_configurations.map(&:name).sort.should == %w{ AppStore Debug Release Test } @project.build_configurations.map(&:name).sort.should == %w{ AppStore Debug Release Test }
end end
it "adds build configurations named after every configuration across all of the user's projects to a target" do
@project.user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'Test' => :debug, 'AppStore' => :release }
target = @project.add_pod_target('SomeTarget', Pod::Platform.ios)
target.build_settings('Test')["VALIDATE_PRODUCT"].should == nil
target.build_settings('AppStore')["VALIDATE_PRODUCT"].should == "YES"
end
describe "concerning its :ios targets" do describe "concerning its :ios targets" do
it "sets VALIDATE_PRODUCT to YES for the Release configuration" do it "sets VALIDATE_PRODUCT to YES for the Release configuration" do
target = Pod::Project.new.add_pod_target('Pods', Pod::Platform.ios) target = Pod::Project.new.add_pod_target('Pods', Pod::Platform.ios)
......
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