Commit f28be2d1 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #2606 from CocoaPods/clintegracon_patch

Update to new CLIntegracon Patch
parents af4579ef 1b24ef0c
...@@ -27,8 +27,8 @@ module Pod ...@@ -27,8 +27,8 @@ module Pod
# #
def integrate! def integrate!
UI.section(integration_message) do UI.section(integration_message) do
XCConfigIntegrator.integrate(target, native_targets) user_project.save if XCConfigIntegrator.integrate(target, native_targets)
update_to_cocoapods_0_34 user_project.save if update_to_cocoapods_0_34
unless native_targets_to_integrate.empty? unless native_targets_to_integrate.empty?
add_pods_library add_pods_library
...@@ -52,6 +52,8 @@ module Pod ...@@ -52,6 +52,8 @@ module Pod
# Fixes the paths of the copy resource scripts. # Fixes the paths of the copy resource scripts.
# #
# @return [Bool] whether any changes to the project were made.
#
# @todo This can be removed for CocoaPods 1.0 # @todo This can be removed for CocoaPods 1.0
# #
def update_to_cocoapods_0_34 def update_to_cocoapods_0_34
...@@ -62,9 +64,15 @@ module Pod ...@@ -62,9 +64,15 @@ module Pod
end.flatten end.flatten
script_path = target.copy_resources_script_relative_path script_path = target.copy_resources_script_relative_path
shell_script = %("#{script_path}"\n)
changes = false
phases.each do |phase| phases.each do |phase|
phase.shell_script = %("#{script_path}"\n) unless phase.shell_script == shell_script
phase.shell_script = shell_script
changes = true
end
end end
changes
end end
# Adds spec libraries to the frameworks build phase of the # Adds spec libraries to the frameworks build phase of the
......
...@@ -15,13 +15,17 @@ module Pod ...@@ -15,13 +15,17 @@ module Pod
# The native targets associated which should be integrated # The native targets associated which should be integrated
# with the Pod bundle. # with the Pod bundle.
# #
# @return [Bool] whether any changes to the project were made.
#
def self.integrate(pod_bundle, targets) def self.integrate(pod_bundle, targets)
changes = false
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) changes = true if update_to_cocoapods_0_34(pod_bundle, targets)
set_target_xcconfig(pod_bundle, target, config) changes = true if set_target_xcconfig(pod_bundle, target, config)
end end
end end
changes
end end
private private
...@@ -38,10 +42,13 @@ module Pod ...@@ -38,10 +42,13 @@ module Pod
# @param [Array<XcodeProj::PBXNativeTarget>] targets # @param [Array<XcodeProj::PBXNativeTarget>] targets
# The native targets. # The native targets.
# #
# @return [Bool] whether any changes to the project were made.
#
# @todo This can be removed for CocoaPods 1.0 # @todo This can be removed for CocoaPods 1.0
# #
def self.update_to_cocoapods_0_34(pod_bundle, targets) def self.update_to_cocoapods_0_34(pod_bundle, targets)
sandbox = pod_bundle.sandbox sandbox = pod_bundle.sandbox
changes = false
targets.map(&:project).uniq.each do |project| targets.map(&:project).uniq.each do |project|
file_refs = project.files.select do |file_ref| file_refs = project.files.select do |file_ref|
path = file_ref.path.to_s path = file_ref.path.to_s
...@@ -57,7 +64,10 @@ module Pod ...@@ -57,7 +64,10 @@ module Pod
file_ref.remove_from_project file_ref.remove_from_project
end end
end end
changes = true unless file_refs.empty?
end end
changes
end end
# Creates a file reference to the xcconfig generated by # Creates a file reference to the xcconfig generated by
...@@ -84,7 +94,8 @@ module Pod ...@@ -84,7 +94,8 @@ module Pod
'all, please either set the base configurations of the target ' \ 'all, please either set the base configurations of the target ' \
"#{target.name}` to `#{path}` or include the `#{path}` in your " \ "#{target.name}` to `#{path}` or include the `#{path}` in your " \
'build configuration.' 'build configuration.'
else false
elsif !file_ref
file_ref ||= group.new_file(path) file_ref ||= group.new_file(path)
config.base_configuration_reference = file_ref config.base_configuration_reference = file_ref
end end
......
...@@ -73,7 +73,7 @@ CLIntegracon.configure do |c| ...@@ -73,7 +73,7 @@ CLIntegracon.configure do |c|
# Remove CocoaPods version # Remove CocoaPods version
yaml = File.open(path) { |f| YAML.load(f) } yaml = File.open(path) { |f| YAML.load(f) }
yaml.delete('COCOAPODS') yaml.delete('COCOAPODS')
yaml.to_s YAML.dump(yaml)
end end
end end
......
...@@ -94,6 +94,8 @@ module Pod ...@@ -94,6 +94,8 @@ module Pod
end end
it 'does not perform the integration if there are no targets to integrate' do it 'does not perform the integration if there are no targets to integrate' do
Installer::UserProjectIntegrator::TargetIntegrator::XCConfigIntegrator.
integrate(@pod_bundle, @target_integrator.send(:native_targets))
@target_integrator.stubs(:native_targets_to_integrate).returns([]) @target_integrator.stubs(:native_targets_to_integrate).returns([])
@target_integrator.expects(:add_pods_library).never @target_integrator.expects(:add_pods_library).never
@target_integrator.expects(:add_copy_resources_script_phase).never @target_integrator.expects(:add_copy_resources_script_phase).never
......
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