Commit 5c2e61e2 authored by Danielle Tomlinson's avatar Danielle Tomlinson Committed by GitHub

Merge pull request #6483 from dnkoutso/better-srcroot

Target integrator now uses relative path to Podfile for build phase s…
parents 015108ee 90992542
......@@ -19,6 +19,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6481](https://github.com/CocoaPods/CocoaPods/pull/6481)
* Uses `${PODS_PODFILE_DIR_PATH}` for generated manifest lock script phase.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#5499](https://github.com/CocoaPods/CocoaPods/issues/5499)
* Do not generate `UIRequiredDeviceCapabilities` for `tvOS` Info.plists.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6193](https://github.com/CocoaPods/CocoaPods/issues/6193)
......
......@@ -56,6 +56,7 @@ module Pod
includes_static_libs ||= pod_targets.flat_map(&:file_accessors).any? { |fa| !fa.vendored_static_artifacts.empty? }
config = {
'OTHER_LDFLAGS' => '$(inherited) ' + XCConfigHelper.default_ld_flags(target, includes_static_libs),
'PODS_PODFILE_DIR_PATH' => target.podfile_dir_relative_path,
'PODS_ROOT' => target.relative_pods_root,
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) ',
......
......@@ -177,7 +177,7 @@ module Pod
phase = create_or_update_build_phase(native_target, phase_name)
native_target.build_phases.unshift(phase).uniq! unless native_target.build_phases.first == phase
phase.shell_script = <<-SH.strip_heredoc
diff "${SRCROOT}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [ $? != 0 ] ; then
# print error to STDERR
echo "error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation." >&2
......
......@@ -204,6 +204,16 @@ module Pod
"${SRCROOT}/#{sandbox.root.relative_path_from(client_root)}"
end
# @return [String] The path of the Podfile directory relative to the
# root of the user project.
#
def podfile_dir_relative_path
podfile_path = target_definition.podfile.defined_in_file
return "${SRCROOT}/#{podfile_path.relative_path_from(client_root).dirname}" unless podfile_path.nil?
# Fallback to the standard path if the Podfile is not represented by a file.
'${PODS_ROOT}/..'
end
# @param [String] config_name The build configuration name to get the xcconfig for
# @return [String] The path of the xcconfig file relative to the root of
# the user project.
......
Subproject commit d6b41d09e7a076f2f0078bce2f7cb1af9a7724a0
Subproject commit e62f3157268e9d2fe634dfab2560c89013d89240
......@@ -30,6 +30,28 @@ module Pod
@generator.target.relative_pods_root.should == '${SRCROOT}/Pods'
end
it 'returns the path of the podfile directory relative to the standard user project' do
podfile = @target.target_definition.podfile
podfile.stubs(:defined_in_file).returns(Pathname.new(@target.client_root) + 'Podfile')
@target.target_definition.stubs(:podfile).returns(podfile)
@generator.target.podfile_dir_relative_path.should == '${SRCROOT}/.'
end
it 'returns the path of the podfile directory relative to a nested user project' do
podfile = @target.target_definition.podfile
podfile.stubs(:defined_in_file).returns(Pathname.new(@target.client_root) + 'Podfile')
@target.target_definition.stubs(:podfile).returns(podfile)
@target.client_root = Pathname.new(@target.client_root) + 'NestedFolder'
@generator.target.podfile_dir_relative_path.should == '${SRCROOT}/..'
end
it 'returns the standard path if the podfile is not defined in file' do
podfile = @target.target_definition.podfile
podfile.stubs(:defined_in_file).returns(nil)
@target.target_definition.stubs(:podfile).returns(podfile)
@generator.target.podfile_dir_relative_path.should == '${PODS_ROOT}/..'
end
#--------------------------------------------------------------------#
before do
......
......@@ -95,7 +95,7 @@ module Pod
phase_name = @phase_prefix + Installer::UserProjectIntegrator::TargetIntegrator::CHECK_MANIFEST_PHASE_NAME
phase = target.shell_script_build_phases.find { |bp| bp.name == phase_name }
phase.shell_script.should == <<-EOS.strip_heredoc
diff "${SRCROOT}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [ $? != 0 ] ; then
# print error to STDERR
echo "error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation." >&2
......
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