Commit 4fd6e57f authored by Robert S. Jones's avatar Robert S. Jones Committed by Samuel E. Giddins

Modify add_xcode_base_configuration to respect existing base

configurations:
 - Do not change the base configuration when it is already set
 - Notify the user when there is an existing base configuration

Change string quoting from double to single quotes.

Split lines longer than 80 characters into multiple lines.

Quote initial string fragment with single quotes rather than double quotes.
parent 52c2f915
......@@ -16,6 +16,10 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Samuel Giddins](https://github.com/segiddins)
[#2577](https://github.com/CocoaPods/CocoaPods/issues/2577)
* Integration with user project will no longer replace an existing
base build configuration.
[Robert Jones](https://github.com/redshirtrob)
##### Bug Fixes
* Improved sanitizing of configuration names to avoid generating invalid
......
......@@ -19,7 +19,7 @@ module Pod
targets.each do |target|
target.build_configurations.each do |config|
update_to_cocoapods_0_34(pod_bundle, targets)
set_target_xcconfig(pod_bundle, config)
set_target_xcconfig(pod_bundle, target, config)
end
end
end
......@@ -35,7 +35,7 @@ module Pod
# @param [Target::AggregateTarget] pod_bundle
# The Pods bundle.
#
# @param [XcodeProj::PBXNativeTarget] target
# @param [Array<XcodeProj::PBXNativeTarget>] targets
# The native targets.
#
# @todo This can be removed for CocoaPods 1.0
......@@ -67,15 +67,25 @@ module Pod
# @param [Target::AggregateTarget] pod_bundle
# The Pods bundle.
#
# @param [[Xcodeproj::XCBuildConfiguration] config
# @param [PBXNativeTarget] target
# The native target.
#
# @param [Xcodeproj::XCBuildConfiguration] config
# The build configuration.
#
def self.set_target_xcconfig(pod_bundle, config)
def self.set_target_xcconfig(pod_bundle, target, config)
path = pod_bundle.xcconfig_relative_path(config.name)
group = config.project['Pods'] || config.project.new_group('Pods')
file_ref = group.files.find { |f| f.path == path }
file_ref ||= group.new_file(path)
config.base_configuration_reference = file_ref
if config.base_configuration_reference != file_ref
UI.warn "CocoaPods did not set the base configuration of your " \
"project because one is already set. Please either set the " \
"base configurations of the target `#{target.name}` to " \
"`#{path}` or include the `#{path}` in your build configuration."
else
file_ref ||= group.new_file(path)
config.base_configuration_reference = file_ref
end
end
private
......
......@@ -48,5 +48,19 @@ module Pod
config.base_configuration_reference.should.equal existing
end
it 'does not set the Pods xcconfig as the base config if the base ' \
'config is already set' do
sample_config = @project.new_file('SampleConfig.xcconfig')
@target.build_configurations.each do |config|
config.base_configuration_reference = sample_config
end
XCConfigIntegrator.integrate(@pod_bundle, [@target])
@target.build_configurations.each do |config|
config.base_configuration_reference.should == sample_config
end
UI.warnings.should.match /not set.*base configuration/
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