Commit ab5f46cd authored by Fabio Pelosin's avatar Fabio Pelosin

Merge pull request #946 from stigi/feature/pod-lock-sync

Integrate a build phase that checks if Manifest.lock is in sync
parents 34cca83d bc5f8f42
......@@ -29,6 +29,7 @@ module Pod
add_xcconfig_base_configuration
add_pods_library
add_copy_resources_script_phase
add_check_manifest_lock_script_phase
save_user_project
end
end
......@@ -129,6 +130,29 @@ module Pod
end
end
# Adds a shell script build phase responsible for checking if the Pods
# locked in the Pods/Manifest.lock file are in sync with the Pods defined
# in the Podfile.lock.
#
# @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
cat << EOM
Podfile.lock and Manifest.lock are not in sync.
You might need to run a \`pod install\`.
EOM
exit 1
fi
EOS
target.build_phases.rotate!(-1) # if we fail, let's fail early
end
end
# Saves the changes to the user project to the disk.
#
# @return [void]
......
......@@ -332,6 +332,16 @@ module Pod
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
#--------------------------------------#
......
......@@ -80,6 +80,27 @@ module Pod
phase.shell_script.strip.should == "\"${SRCROOT}/../Pods/Pods-resources.sh\""
end
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
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
it 'adds the Check Manifest.lock build phase as the first build phase' do
target = @target_integrator.targets.first
phase = target.build_phases.find { |bp| bp.name == "Check Pods Manifest.lock" }
target.build_phases.first.should.equal? phase
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