Commit a19220a2 authored by Fabio Pelosin's avatar Fabio Pelosin

[TargetIntegrator] Fix the path of the copy resource script if needed

parent 7f0d439f
...@@ -28,6 +28,8 @@ module Pod ...@@ -28,6 +28,8 @@ module Pod
def integrate! def integrate!
UI.section(integration_message) do UI.section(integration_message) do
XCConfigIntegrator.integrate(target, native_targets) XCConfigIntegrator.integrate(target, native_targets)
update_to_cocoapods_0_34
unless native_targets_to_integrate.empty? unless native_targets_to_integrate.empty?
add_pods_library add_pods_library
add_copy_resources_script_phase add_copy_resources_script_phase
...@@ -48,6 +50,23 @@ module Pod ...@@ -48,6 +50,23 @@ module Pod
# @!group Integration steps # @!group Integration steps
#---------------------------------------------------------------------# #---------------------------------------------------------------------#
# Fixes the paths of the copy resource scripts.
#
# @todo This can be removed for CocoaPods 1.0
#
def update_to_cocoapods_0_34
phases = native_targets.map do |target|
target.shell_script_build_phases.select do |bp|
bp.name == 'Copy Pods Resources'
end
end.flatten
script_path = target.copy_resources_script_relative_path
phases.each do |phase|
phase.shell_script = %("#{script_path}"\n)
end
end
# Adds spec libraries to the frameworks build phase of the # Adds spec libraries to the frameworks build phase of the
# {TargetDefinition} integration libraries. Adds a file reference to # {TargetDefinition} integration libraries. Adds a file reference to
# the library of the {TargetDefinition} and adds it to the frameworks # the library of the {TargetDefinition} and adds it to the frameworks
...@@ -75,9 +94,9 @@ module Pod ...@@ -75,9 +94,9 @@ module Pod
def add_copy_resources_script_phase def add_copy_resources_script_phase
phase_name = 'Copy Pods Resources' phase_name = 'Copy Pods Resources'
native_targets_to_integrate.each do |native_target| native_targets_to_integrate.each do |native_target|
phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first || phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first
native_target.new_shell_script_build_phase(phase_name) phase ||= native_target.new_shell_script_build_phase(phase_name)
script_path = target.copy_resources_script_relative_path script_path = target.copy_resources_script_relative_path
phase.shell_script = %("#{script_path}"\n) phase.shell_script = %("#{script_path}"\n)
phase.show_env_vars_in_log = '0' phase.show_env_vars_in_log = '0'
end end
......
...@@ -18,7 +18,7 @@ module Pod ...@@ -18,7 +18,7 @@ module Pod
def self.integrate(pod_bundle, targets) def self.integrate(pod_bundle, targets)
targets.each do |target| targets.each do |target|
target.build_configurations.each do |config| target.build_configurations.each do |config|
update_from_cocoapods_0_33_1(pod_bundle, targets) update_to_cocoapods_0_34(pod_bundle, targets)
set_target_xcconfig(pod_bundle, config) set_target_xcconfig(pod_bundle, config)
end end
end end
...@@ -40,7 +40,7 @@ module Pod ...@@ -40,7 +40,7 @@ module Pod
# #
# @todo This can be removed for CocoaPods 1.0 # @todo This can be removed for CocoaPods 1.0
# #
def self.update_from_cocoapods_0_33_1(pod_bundle, targets) def self.update_to_cocoapods_0_34(pod_bundle, targets)
sandbox = pod_bundle.sandbox sandbox = pod_bundle.sandbox
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|
......
...@@ -41,6 +41,15 @@ module Pod ...@@ -41,6 +41,15 @@ module Pod
@target_integrator.integrate! @target_integrator.integrate!
end end
it 'fixes the copy resource scripts of legacy installations' do
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Copy Pods Resources' }
phase.shell_script = %("${SRCROOT}/../Pods/Pods-resources.sh"\n)
@target_integrator.integrate!
phase.shell_script.strip.should == "\"${SRCROOT}/../Pods/Target Support Files/Pods-resources.sh\""
end
it 'adds references to the Pods static libraries to the Frameworks group' do it 'adds references to the Pods static libraries to the Frameworks group' do
@target_integrator.integrate! @target_integrator.integrate!
@target_integrator.send(:user_project)['Frameworks/libPods.a'].should.not.nil? @target_integrator.send(:user_project)['Frameworks/libPods.a'].should.not.nil?
......
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