Commit 660d5a61 authored by Eloy Duran's avatar Eloy Duran

Add build configs of all the user's projects to the Pods project.

Still need to do it at the target level too.
parent 8453f585
...@@ -3,13 +3,13 @@ module Pod ...@@ -3,13 +3,13 @@ module Pod
class UserProject class UserProject
include Config::Mixin include Config::Mixin
DEFAULT_CONFIGURATIONS = { 'Debug' => :debug, 'Release' => :release }.freeze DEFAULT_BUILD_CONFIGURATIONS = { 'Debug' => :debug, 'Release' => :release }.freeze
attr_reader :configurations attr_reader :build_configurations
def initialize(path = nil, configurations = {}) def initialize(path = nil, build_configurations = {})
self.path = path if path self.path = path if path
@configurations = configurations.merge(DEFAULT_CONFIGURATIONS) @build_configurations = build_configurations.merge(DEFAULT_BUILD_CONFIGURATIONS)
end end
def path=(path) def path=(path)
...@@ -71,10 +71,10 @@ module Pod ...@@ -71,10 +71,10 @@ module Pod
def label def label
if name == :default if name == :default
"Pods" "Pods"
elsif @parent elsif exclusive?
"#{@parent.label}-#{name}"
else
"Pods-#{name}" "Pods-#{name}"
else
"#{@parent.label}-#{name}"
end end
end end
...@@ -208,8 +208,8 @@ module Pod ...@@ -208,8 +208,8 @@ module Pod
# xcodeproj 'TestProject' # xcodeproj 'TestProject'
# end # end
# #
def xcodeproj(path, configurations = {}) def xcodeproj(path, build_configurations = {})
@target_definition.user_project = UserProject.new(path, configurations) @target_definition.user_project = UserProject.new(path, build_configurations)
end end
# Specifies the target(s) in the user’s project that this Pods library # Specifies the target(s) in the user’s project that this Pods library
...@@ -427,6 +427,11 @@ module Pod ...@@ -427,6 +427,11 @@ module Pod
@set_arc_compatibility_flag @set_arc_compatibility_flag
end end
def user_build_configurations
configs_array = @target_definitions.values.map { |td| td.user_project.build_configurations }
configs_array.inject({}) { |hash, config| hash.merge(config) }
end
def post_install!(installer) def post_install!(installer)
@post_install_callback.call(installer) if @post_install_callback @post_install_callback.call(installer) if @post_install_callback
end end
......
...@@ -17,6 +17,14 @@ module Pod ...@@ -17,6 +17,14 @@ module Pod
main_group << groups.new('name' => 'Pods') main_group << groups.new('name' => 'Pods')
end end
def add_build_configurations(user_configurations)
user_configurations.each do |name, _|
unless build_configurations.map(&:name).include?(name)
build_configurations.new('name' => name)
end
end
end
# Shortcut access to the `Pods' PBXGroup. # Shortcut access to the `Pods' PBXGroup.
def pods def pods
groups.find { |g| g.name == 'Pods' } || groups.new({ 'name' => 'Pods' }) groups.find { |g| g.name == 'Pods' } || groups.new({ 'name' => 'Pods' })
......
...@@ -250,10 +250,11 @@ describe "Pod::Podfile" do ...@@ -250,10 +250,11 @@ describe "Pod::Podfile" do
it "returns the custom configurations, that the user's project contains, and wether it should be based on a debug or a release build" do it "returns the custom configurations, that the user's project contains, and wether it should be based on a debug or a release build" do
all = { 'Release' => :release, 'Debug' => :debug, 'Test' => :debug } all = { 'Release' => :release, 'Debug' => :debug, 'Test' => :debug }
@podfile.target_definitions[:default].user_project.configurations.should == all.merge('iOS App Store' => :release) @podfile.target_definitions[:default].user_project.build_configurations.should == all.merge('iOS App Store' => :release)
@podfile.target_definitions[:test].user_project.configurations.should == all.merge('iOS App Store' => :release) @podfile.target_definitions[:test].user_project.build_configurations.should == all.merge('iOS App Store' => :release)
@podfile.target_definitions[:osx_target].user_project.configurations.should == all.merge('Mac App Store' => :release) @podfile.target_definitions[:osx_target].user_project.build_configurations.should == all.merge('Mac App Store' => :release)
@podfile.target_definitions[:nested_osx_target].user_project.configurations.should == all.merge('Mac App Store' => :release) @podfile.target_definitions[:nested_osx_target].user_project.build_configurations.should == all.merge('Mac App Store' => :release)
@podfile.user_build_configurations.should == all.merge('iOS App Store' => :release, 'Mac App Store' => :release)
end end
describe "with an Xcode project that's not in the project_root" do describe "with an Xcode project that's not in the project_root" do
......
...@@ -33,6 +33,11 @@ describe 'Pod::Project' do ...@@ -33,6 +33,11 @@ describe 'Pod::Project' do
@project.targets.first.build_phases.should.include phase @project.targets.first.build_phases.should.include phase
end end
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.build_configurations.map(&:name).sort.should == %w{ AppStore Debug Release Test }
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