Commit 013ec94a authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #3549 from CocoaPods/mr-ensure-check-manifest-lock-script-update

[TargetIntegrator] Ensure to reset the contents of the Manifest.lock Script Phase
parents 4b4d5a49 345bc370
...@@ -142,19 +142,13 @@ module Pod ...@@ -142,19 +142,13 @@ module Pod
# @return [void] # @return [void]
# #
def add_embed_frameworks_script_phase def add_embed_frameworks_script_phase
phase_name = 'Embed Pods Frameworks'
targets_to_embed_in = native_targets_to_integrate.select do |target| targets_to_embed_in = native_targets_to_integrate.select do |target|
EMBED_FRAMEWORK_TARGET_TYPES.include?(target.symbol_type) EMBED_FRAMEWORK_TARGET_TYPES.include?(target.symbol_type)
end end
targets_to_embed_in.each do |native_target| targets_to_embed_in.each do |native_target|
embed_build_phase = native_target.shell_script_build_phases.find { |bp| bp.name == phase_name } phase = create_or_update_build_phase(native_target, 'Embed Pods Frameworks')
unless embed_build_phase.present?
UI.message("Adding Build Phase '#{phase_name}' to project.")
embed_build_phase = native_target.new_shell_script_build_phase(phase_name)
end
script_path = target.embed_frameworks_script_relative_path script_path = target.embed_frameworks_script_relative_path
embed_build_phase.shell_script = %("#{script_path}"\n) phase.shell_script = %("#{script_path}"\n)
embed_build_phase.show_env_vars_in_log = '0'
end end
end end
...@@ -189,11 +183,9 @@ module Pod ...@@ -189,11 +183,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.find { |bp| bp.name == phase_name } phase = create_or_update_build_phase(native_target, 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'
end end
end end
...@@ -209,10 +201,8 @@ module Pod ...@@ -209,10 +201,8 @@ module Pod
def add_check_manifest_lock_script_phase def add_check_manifest_lock_script_phase
phase_name = 'Check Pods Manifest.lock' phase_name = 'Check Pods Manifest.lock'
native_targets_to_integrate.each do |native_target| native_targets_to_integrate.each do |native_target|
next if native_target.shell_script_build_phases.any? { |phase| phase.name == phase_name } phase = create_or_update_build_phase(native_target, phase_name)
phase = native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase) native_target.build_phases.unshift(phase).uniq!
native_target.build_phases.unshift(phase)
phase.name = phase_name
phase.shell_script = <<-EOS.strip_heredoc phase.shell_script = <<-EOS.strip_heredoc
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then if [[ $? != 0 ]] ; then
...@@ -222,7 +212,6 @@ module Pod ...@@ -222,7 +212,6 @@ module Pod
exit 1 exit 1
fi fi
EOS EOS
phase.show_env_vars_in_log = '0'
end end
end end
...@@ -278,6 +267,17 @@ module Pod ...@@ -278,6 +267,17 @@ module Pod
"Integrating target `#{target.name}` " \ "Integrating target `#{target.name}` " \
"(#{UI.path target.user_project_path} project)" "(#{UI.path target.user_project_path} project)"
end end
def create_or_update_build_phase(target, phase_name, phase_class = Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
phase = target.build_phases.grep(phase_class).find { |phase| phase.name == phase_name } ||
(target.project.new(phase_class).tap do |phase|
UI.message("Adding Build Phase '#{phase_name}' to project.") do
phase.name = phase_name
phase.show_env_vars_in_log = '0'
target.build_phases << phase
end
end)
end
end 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