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