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
class UserProject
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
@configurations = configurations.merge(DEFAULT_CONFIGURATIONS)
@build_configurations = build_configurations.merge(DEFAULT_BUILD_CONFIGURATIONS)
end
def path=(path)
......@@ -71,10 +71,10 @@ module Pod
def label
if name == :default
"Pods"
elsif @parent
"#{@parent.label}-#{name}"
else
elsif exclusive?
"Pods-#{name}"
else
"#{@parent.label}-#{name}"
end
end
......@@ -208,8 +208,8 @@ module Pod
# xcodeproj 'TestProject'
# end
#
def xcodeproj(path, configurations = {})
@target_definition.user_project = UserProject.new(path, configurations)
def xcodeproj(path, build_configurations = {})
@target_definition.user_project = UserProject.new(path, build_configurations)
end
# Specifies the target(s) in the user’s project that this Pods library
......@@ -427,6 +427,11 @@ module Pod
@set_arc_compatibility_flag
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)
@post_install_callback.call(installer) if @post_install_callback
end
......
......@@ -17,6 +17,14 @@ module Pod
main_group << groups.new('name' => 'Pods')
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.
def pods
groups.find { |g| g.name == 'Pods' } || groups.new({ 'name' => 'Pods' })
......
......@@ -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
all = { 'Release' => :release, 'Debug' => :debug, 'Test' => :debug }
@podfile.target_definitions[:default].user_project.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[:osx_target].user_project.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[:default].user_project.build_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.build_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
describe "with an Xcode project that's not in the project_root" do
......
......@@ -33,6 +33,11 @@ describe 'Pod::Project' do
@project.targets.first.build_phases.should.include phase
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
it "sets VALIDATE_PRODUCT to YES for the Release configuration" do
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