Commit 615d0768 authored by Samuel Giddins's avatar Samuel Giddins

[XCConfigIntegrator] Add spec for re-integrating when old config was in the CocoaPods sandbox

parent 629b02f3
...@@ -79,9 +79,14 @@ module Pod ...@@ -79,9 +79,14 @@ module Pod
file_ref = group.files.find { |f| f.path == path } file_ref = group.files.find { |f| f.path == path }
existing = config.base_configuration_reference existing = config.base_configuration_reference
set_base_configuration_reference = ->() do
file_ref ||= group.new_file(path)
config.base_configuration_reference = file_ref
end
if existing && existing != file_ref if existing && existing != file_ref
if existing.real_path.to_path.start_with?(pod_bundle.support_files_dir.to_path) if existing.real_path.to_path.start_with?(pod_bundle.support_files_dir.to_path)
existing.path = path set_base_configuration_reference.call
elsif !xcconfig_includes_target_xcconfig?(config.base_configuration_reference, path) elsif !xcconfig_includes_target_xcconfig?(config.base_configuration_reference, path)
UI.warn 'CocoaPods did not set the base configuration of your ' \ UI.warn 'CocoaPods did not set the base configuration of your ' \
'project because your project already has a custom ' \ 'project because your project already has a custom ' \
...@@ -91,8 +96,7 @@ module Pod ...@@ -91,8 +96,7 @@ module Pod
'build configuration.' 'build configuration.'
end end
elsif config.base_configuration_reference.nil? || file_ref.nil? elsif config.base_configuration_reference.nil? || file_ref.nil?
file_ref ||= group.new_file(path) set_base_configuration_reference.call
config.base_configuration_reference = file_ref
end end
end end
......
...@@ -5,7 +5,7 @@ module Pod ...@@ -5,7 +5,7 @@ module Pod
before do before do
project_path = SpecHelper.create_sample_app_copy_from_fixture('SampleProject') project_path = SpecHelper.create_sample_app_copy_from_fixture('SampleProject')
@project = Xcodeproj::Project.open(project_path) @project = Xcodeproj::Project.open(project_path)
Xcodeproj::Project.new(config.sandbox.project_path).save Project.new(config.sandbox.project_path).save
@target = @project.targets.first @target = @project.targets.first
target_definition = Podfile::TargetDefinition.new('Pods', nil) target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.link_with_first_target = true target_definition.link_with_first_target = true
...@@ -105,5 +105,20 @@ module Pod ...@@ -105,5 +105,20 @@ module Pod
UI.warnings.should.not.match /not set.*base configuration/ UI.warnings.should.not.match /not set.*base configuration/
end end
it 'handles when xcconfig is set to another sandox xcconfig' do
group = @project.new_group('Pods')
old_config = group.new_file('../Pods/Target Support Files/Pods/SampleConfig.xcconfig')
@target.build_configurations.each do |config|
config.base_configuration_reference = old_config
end
XCConfigIntegrator.integrate(@pod_bundle, [@target])
@target.build_configurations.each do |config|
config.base_configuration_reference.should.not == old_config
config.base_configuration_reference.path.should == @pod_bundle.xcconfig_relative_path(config.name)
end
UI.warnings.should.be.empty
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