Do not crash when creating build settings for a missing user build configuration

parent ab98c0e6
...@@ -23,6 +23,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -23,6 +23,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* Do not crash when creating build settings for a missing user build configuration
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7698](https://github.com/CocoaPods/CocoaPods/pull/7698)
* Do not include test dependencies input and output paths * Do not include test dependencies input and output paths
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7688](https://github.com/CocoaPods/CocoaPods/pull/7688) [#7688](https://github.com/CocoaPods/CocoaPods/pull/7688)
......
...@@ -95,6 +95,7 @@ module Pod ...@@ -95,6 +95,7 @@ module Pod
# #
def create_xcconfig_file(native_target) def create_xcconfig_file(native_target)
native_target.build_configurations.each do |configuration| native_target.build_configurations.each do |configuration|
next unless target.user_build_configurations.key?(configuration.name)
path = target.xcconfig_path(configuration.name) path = target.xcconfig_path(configuration.name)
build_settings = target.build_settings(configuration.name) build_settings = target.build_settings(configuration.name)
update_changed_file(build_settings, path) update_changed_file(build_settings, path)
......
...@@ -19,6 +19,7 @@ module Pod ...@@ -19,6 +19,7 @@ module Pod
config.sandbox.project = @project config.sandbox.project = @project
path_list = Sandbox::PathList.new(fixture('banana-lib')) path_list = Sandbox::PathList.new(fixture('banana-lib'))
@spec = fixture_spec('banana-lib/BananaLib.podspec') @spec = fixture_spec('banana-lib/BananaLib.podspec')
@spec.prefix_header_contents = '#import "BlocksKit.h"'
file_accessor = Sandbox::FileAccessor.new(path_list, @spec.consumer(:ios)) file_accessor = Sandbox::FileAccessor.new(path_list, @spec.consumer(:ios))
@project.add_pod_group('BananaLib', fixture('banana-lib')) @project.add_pod_group('BananaLib', fixture('banana-lib'))
group = @project.group_for_spec('BananaLib') group = @project.group_for_spec('BananaLib')
...@@ -26,12 +27,17 @@ module Pod ...@@ -26,12 +27,17 @@ module Pod
@project.add_file_reference(file, group) @project.add_file_reference(file, group)
end end
user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug } @platform = Platform.new(:ios, '6.0')
@pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], Platform.new(:ios, '6.0'), [@spec], [@target_definition], [file_accessor])
user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release,
'Test' => :debug }
@pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], @platform, [@spec],
[@target_definition], [file_accessor])
pod_targets_by_config = Hash[user_build_configurations.each_key.map { |c| [c, [@pod_target]] }] pod_targets_by_config = Hash[user_build_configurations.each_key.map { |c| [c, [@pod_target]] }]
@target = AggregateTarget.new(config.sandbox, false, user_build_configurations, [], Platform.new(:ios, '6.0'), @target_definition, config.sandbox.root.dirname, nil, nil, pod_targets_by_config) @target = AggregateTarget.new(config.sandbox, false, user_build_configurations, [], @platform,
@target_definition, config.sandbox.root.dirname, nil, nil,
pod_targets_by_config)
@installer = AggregateTargetInstaller.new(config.sandbox, @project, @target) @installer = AggregateTargetInstaller.new(config.sandbox, @project, @target)
@spec.prefix_header_contents = '#import "BlocksKit.h"'
end end
it 'adds file references for the support files of the target' do it 'adds file references for the support files of the target' do
...@@ -261,6 +267,22 @@ module Pod ...@@ -261,6 +267,22 @@ module Pod
build_file.should.not.be.nil build_file.should.not.be.nil
build_file.settings.should == { 'ATTRIBUTES' => ['Public'] } build_file.settings.should == { 'ATTRIBUTES' => ['Public'] }
end end
it 'does not create xcconfigs for non existent user build configurations' do
target = AggregateTarget.new(config.sandbox, false, { 'Debug' => :debug }, [], @platform,
@target_definition, config.sandbox.root.dirname, nil, nil, {})
@installer = AggregateTargetInstaller.new(config.sandbox, @project, target)
@installer.install!
group = @project.support_files_group['Pods-SampleProject']
group.children.map(&:display_name).sort.should == [
'Pods-SampleProject-acknowledgements.markdown',
'Pods-SampleProject-acknowledgements.plist',
'Pods-SampleProject-dummy.m',
'Pods-SampleProject-frameworks.sh',
'Pods-SampleProject-resources.sh',
'Pods-SampleProject.debug.xcconfig',
]
end
end end
end 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