Commit 7ddfdd3f authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #2581 from CocoaPods/use_base_configuration

Modify add_xcode_base_configuration to respect existing base configurations
parents 5d6109d0 320548b7
...@@ -16,6 +16,11 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -16,6 +16,11 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
[#2577](https://github.com/CocoaPods/CocoaPods/issues/2577) [#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)
[#1736](https://github.com/CocoaPods/CocoaPods/issues/1736)
##### Bug Fixes ##### Bug Fixes
* Improved sanitizing of configuration names to avoid generating invalid * Improved sanitizing of configuration names to avoid generating invalid
......
...@@ -19,7 +19,7 @@ module Pod ...@@ -19,7 +19,7 @@ module Pod
targets.each do |target| targets.each do |target|
target.build_configurations.each do |config| target.build_configurations.each do |config|
update_to_cocoapods_0_34(pod_bundle, targets) update_to_cocoapods_0_34(pod_bundle, targets)
set_target_xcconfig(pod_bundle, config) set_target_xcconfig(pod_bundle, target, config)
end end
end end
end end
...@@ -35,7 +35,7 @@ module Pod ...@@ -35,7 +35,7 @@ module Pod
# @param [Target::AggregateTarget] pod_bundle # @param [Target::AggregateTarget] pod_bundle
# The Pods bundle. # The Pods bundle.
# #
# @param [XcodeProj::PBXNativeTarget] target # @param [Array<XcodeProj::PBXNativeTarget>] targets
# The native targets. # The native targets.
# #
# @todo This can be removed for CocoaPods 1.0 # @todo This can be removed for CocoaPods 1.0
...@@ -67,15 +67,27 @@ module Pod ...@@ -67,15 +67,27 @@ module Pod
# @param [Target::AggregateTarget] pod_bundle # @param [Target::AggregateTarget] pod_bundle
# The Pods bundle. # The Pods bundle.
# #
# @param [[Xcodeproj::XCBuildConfiguration] config # @param [PBXNativeTarget] target
# The native target.
#
# @param [Xcodeproj::XCBuildConfiguration] config
# The build configuration. # 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) path = pod_bundle.xcconfig_relative_path(config.name)
group = config.project['Pods'] || config.project.new_group('Pods') group = config.project['Pods'] || config.project.new_group('Pods')
file_ref = group.files.find { |f| f.path == path } file_ref = group.files.find { |f| f.path == path }
file_ref ||= group.new_file(path) if config.base_configuration_reference != file_ref
config.base_configuration_reference = file_ref UI.warn 'CocoaPods did not set the base configuration of your ' \
'project because because your project already has a custom ' \
'config set. In order for CocoaPods integration to work at ' \
'all, 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 end
private private
......
...@@ -48,5 +48,19 @@ module Pod ...@@ -48,5 +48,19 @@ module Pod
config.base_configuration_reference.should.equal existing config.base_configuration_reference.should.equal existing
end end
it 'does not set the Pods xcconfig as the base config if the user ' \
'has already set a config of their own' 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
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