Commit 12311943 authored by Fabio Pelosin's avatar Fabio Pelosin

[UserProjectIntegrator::TargetIngtegrator] Prepend sandbox check in a safe way (see Xcodeproj API)

parent 0ae92183
require 'active_support'
module Pod
class Installer
class UserProjectIntegrator
......@@ -134,22 +136,26 @@ module Pod
# locked in the Pods/Manifest.lock file are in sync with the Pods defined
# in the Podfile.lock.
#
# @note The build phase is appended to the front because to fail
# fast.
#
# @return [void]
#
def add_check_manifest_lock_script_phase
targets.each do |target|
phase = target.new_shell_script_build_phase('Check Pods Manifest.lock')
phase.shell_script = <<-EOS
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then
phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
target.build_phases.unshift(phase)
phase.name = 'Check Pods Manifest.lock'
phase.shell_script = <<-EOS.strip_heredoc
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then
cat << EOM
Podfile.lock and Manifest.lock are not in sync.
You might need to run a \`pod install\`.
EOM
Podfile.lock and Manifest.lock are not in sync.
You might need to run a \`pod install\`.
EOM
exit 1
fi
fi
EOS
target.build_phases.rotate!(-1) # if we fail, let's fail early
end
end
......
......@@ -302,8 +302,6 @@ module Pod
#--------------------------------------#
# @note The shell script should be the last phase.
#
it "sets up an existing project with pods" do
config.integrate_targets = true
......@@ -331,17 +329,6 @@ module Pod
config.base_configuration_reference.path.should == 'Pods/Pods.xcconfig'
end
target.frameworks_build_phase.files.should.include libPods.build_files.first
target.build_phases.last.shell_script.should == %{"${SRCROOT}/Pods/Pods-resources.sh"\n}
target.build_phases.first.shell_script.should == <<-EOS
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then
cat << EOM
Podfile.lock and Manifest.lock are not in sync.
You might need to run a \`pod install\`.
EOM
exit 1
fi
EOS
end
#--------------------------------------#
......
......@@ -83,15 +83,15 @@ module Pod
it 'adds a Check Manifest.lock build phase to each target' do
target = @target_integrator.targets.first
phase = target.shell_script_build_phases.find { |bp| bp.name == "Check Pods Manifest.lock" }
phase.shell_script.should == <<-EOS
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then
phase.shell_script.should == <<-EOS.strip_heredoc
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then
cat << EOM
Podfile.lock and Manifest.lock are not in sync.
You might need to run a \`pod install\`.
EOM
Podfile.lock and Manifest.lock are not in sync.
You might need to run a \`pod install\`.
EOM
exit 1
fi
fi
EOS
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