Commit 1d71b582 authored by Eloy Duran's avatar Eloy Duran

Move getting paths relative to a Xcode project's ${SRCROOT} to

Pod::Podfile::TargetDefinition.
parent 57c3e267
platform :ios
workspace "RelativePathProject/TheWorkspaceOfTheRelativeProject.xcworkspace"
xcodeproj "RelativePathProject/RelativePathProject.xcodeproj"
dependency "AFNetworking"
<?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:Pods/Pods.xcodeproj'/><FileRef location='group:RelativePathProject/RelativePathProject.xcodeproj'/></Workspace>
\ No newline at end of file
......@@ -10,7 +10,40 @@
<string>46</string>
<key>objects</key>
<dict>
<key>0D44AD8A79844DBFB547AFE1</key>
<key>0655448A743D44CE9C8560F4</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>1BDBB6EEA4904D18883D5049</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>3A4A03DC6930408E8E49B095</key>
<dict>
<key>fileRef</key>
<string>DD3C7BABD6FA4FFB859BA028</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>49592E987DEE4FDBBA2EA98F</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
......@@ -29,15 +62,34 @@
<key>shellPath</key>
<string>/bin/sh</string>
<key>shellScript</key>
<string>"${SRCROOT}/Pods/Pods-resources.sh"
<string>"${SRCROOT}/../Pods/Pods-resources.sh"
</string>
</dict>
<key>4564ED848C694645800D24BF</key>
<key>4B73544C9B594609B70257C2</key>
<dict>
<key>fileRef</key>
<string>7BE04F9FCDE24A588AF38CCA</string>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXBuildFile</string>
<string>PBXFileReference</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>60435663B02542A193962E58</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>7BE04F9FCDE24A588AF38CCA</key>
<dict>
......@@ -47,8 +99,47 @@
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>8B12F3A90ABA4E47905FE316</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<key>path</key>
<string>../Pods/Pods.xcconfig</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>968826D4F729428780EB11C7</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>A317BF0E1976499FAF0A148C</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
......@@ -61,7 +152,7 @@
<string>B50504EF1509774600AFAE65</string>
<string>B50504E81509774600AFAE65</string>
<string>B50504E61509774600AFAE65</string>
<string>BE05502664FD4BA7A5C610EA</string>
<string>8B12F3A90ABA4E47905FE316</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
......@@ -144,7 +235,7 @@
<string>B50504EA1509774600AFAE65</string>
<string>B50504EC1509774600AFAE65</string>
<string>B50504EE1509774600AFAE65</string>
<string>4564ED848C694645800D24BF</string>
<string>3A4A03DC6930408E8E49B095</string>
</array>
<key>isa</key>
<string>PBXFrameworksBuildPhase</string>
......@@ -175,7 +266,7 @@
<string>B50504E11509774600AFAE65</string>
<string>B50504E21509774600AFAE65</string>
<string>B50504E31509774600AFAE65</string>
<string>0D44AD8A79844DBFB547AFE1</string>
<string>49592E987DEE4FDBBA2EA98F</string>
</array>
<key>buildRules</key>
<array/>
......@@ -228,6 +319,16 @@
<string>B50504EB1509774600AFAE65</string>
<string>B50504ED1509774600AFAE65</string>
<string>7BE04F9FCDE24A588AF38CCA</string>
<string>BDDCC8E0B6B44EC5A067C887</string>
<string>B883D8352B9842028C5C0F5D</string>
<string>60435663B02542A193962E58</string>
<string>1BDBB6EEA4904D18883D5049</string>
<string>A317BF0E1976499FAF0A148C</string>
<string>4B73544C9B594609B70257C2</string>
<string>0655448A743D44CE9C8560F4</string>
<string>968826D4F729428780EB11C7</string>
<string>E3F6CFE58972416FB95F9145</string>
<string>DD3C7BABD6FA4FFB859BA028</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
......@@ -238,6 +339,8 @@
</dict>
<key>B50504E91509774600AFAE65</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
......@@ -258,6 +361,8 @@
</dict>
<key>B50504EB1509774600AFAE65</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
......@@ -278,6 +383,8 @@
</dict>
<key>B50504ED1509774600AFAE65</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
......@@ -337,8 +444,6 @@
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.plist.xml</string>
<key>name</key>
<string>RelativePathProject-Info.plist</string>
<key>path</key>
<string>RelativePathProject-Info.plist</string>
<key>sourceTree</key>
......@@ -383,8 +488,6 @@
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>main.m</string>
<key>path</key>
<string>main.m</string>
<key>sourceTree</key>
......@@ -403,8 +506,6 @@
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>name</key>
<string>RelativePathProject-Prefix.pch</string>
<key>path</key>
<string>RelativePathProject-Prefix.pch</string>
<key>sourceTree</key>
......@@ -416,8 +517,6 @@
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>name</key>
<string>CCPAppDelegate.h</string>
<key>path</key>
<string>CCPAppDelegate.h</string>
<key>sourceTree</key>
......@@ -429,8 +528,6 @@
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>CCPAppDelegate.m</string>
<key>path</key>
<string>CCPAppDelegate.m</string>
<key>sourceTree</key>
......@@ -449,8 +546,6 @@
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>name</key>
<string>CCPViewController.h</string>
<key>path</key>
<string>CCPViewController.h</string>
<key>sourceTree</key>
......@@ -462,8 +557,6 @@
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>CCPViewController.m</string>
<key>path</key>
<string>CCPViewController.m</string>
<key>sourceTree</key>
......@@ -634,13 +727,15 @@
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>B50505071509774600AFAE65</key>
<dict>
<key>baseConfigurationReference</key>
<string>BE05502664FD4BA7A5C610EA</string>
<string>8B12F3A90ABA4E47905FE316</string>
<key>buildSettings</key>
<dict>
<key>DSTROOT</key>
......@@ -668,7 +763,7 @@
<key>B50505081509774600AFAE65</key>
<dict>
<key>baseConfigurationReference</key>
<string>BE05502664FD4BA7A5C610EA</string>
<string>8B12F3A90ABA4E47905FE316</string>
<key>buildSettings</key>
<dict>
<key>DSTROOT</key>
......@@ -693,18 +788,59 @@
<key>name</key>
<string>Release</string>
</dict>
<key>BE05502664FD4BA7A5C610EA</key>
<key>B883D8352B9842028C5C0F5D</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>BDDCC8E0B6B44EC5A067C887</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>DD3C7BABD6FA4FFB859BA028</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<string>libPods.a</string>
<key>path</key>
<string>Pods/Pods.xcconfig</string>
<string>libPods.a</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>E3F6CFE58972416FB95F9145</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
</dict>
<key>rootObject</key>
......
<?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:RelativePathProject.xcodeproj'/><FileRef location='group:../Pods/Pods.xcodeproj'/><FileRef location='group:Pods/Pods.xcodeproj'/><FileRef location='group:RelativePathProject/RelativePathProject.xcodeproj'/></Workspace>
\ No newline at end of file
......@@ -17,7 +17,6 @@ module Pod
autoload :Podfile, 'cocoapods/podfile'
autoload :Project, 'cocoapods/project'
autoload :Resolver, 'cocoapods/resolver'
autoload :PodPathResolver, 'cocoapods/pod_path_resolver'
autoload :Sandbox, 'cocoapods/sandbox'
autoload :Source, 'cocoapods/source'
autoload :Spec, 'cocoapods/specification'
......
......@@ -13,7 +13,7 @@ module Pod
def xcconfig
@xcconfig ||= Xcodeproj::Config.new({
# In a workspace this is where the static library headers should be found.
'PODS_ROOT' => Pod::PodPathResolver.new(@target_definition).pods_root,
'PODS_ROOT' => @target_definition.relative_pods_root,
'ALWAYS_SEARCH_USER_PATHS' => 'YES', # needed to make EmbedReader build
'OTHER_LDFLAGS' => default_ld_flags,
})
......@@ -78,7 +78,7 @@ module Pod
config.base_configuration = xcconfig_file
config.build_settings['OTHER_LDFLAGS'] = ''
config.build_settings['GCC_PREFIX_HEADER'] = @target_definition.prefix_header_name
config.build_settings['PODS_ROOT'] = '$(SRCROOT)'
config.build_settings['PODS_ROOT'] = '${SRCROOT}'
end
end
......
......@@ -63,6 +63,14 @@ module Pod
def integrate!
return if targets.empty?
unless Config.instance.silent?
# TODO let's just use ActiveSupport.
plural = targets.size > 1
puts "-> Integrating `#{@target_definition.lib_name}' into target#{'s' if plural} " \
"`#{targets.map(&:name).join(', ')}' of Xcode project `#{user_project_path.basename}'.".green
end
add_xcconfig_base_configuration
add_pods_library
add_copy_resources_script_phase
......@@ -106,16 +114,16 @@ module Pod
# Default to the first, which in a simple project is probably an app target.
[user_project.targets.first]
end.reject do |target|
# Reject any target that already has this Pods library in one of its frameworks build phases
target.frameworks_build_phases.any? do |phase|
phase.files.any? { |file| file.name == @target_definition.lib_name }
# Reject any target that already has this Pods library in one of its frameworks build phases
target.frameworks_build_phases.any? do |phase|
phase.files.any? { |file| file.name == @target_definition.lib_name }
end
end
end
end
end
def add_xcconfig_base_configuration
xcconfig = user_project.files.new('path' => "Pods/#{@target_definition.xcconfig_name}") # TODO use Sandbox?
xcconfig = user_project.files.new('path' => @target_definition.xcconfig_relative_path)
targets.each do |target|
target.build_configurations.each do |config|
config.base_configuration = xcconfig
......@@ -134,7 +142,7 @@ module Pod
targets.each do |target|
phase = target.shell_script_build_phases.new
phase.name = 'Copy Pods Resources'
phase.shell_script = %{"${SRCROOT}/Pods/#{@target_definition.copy_resources_script_name}"\n}
phase.shell_script = %{"#{@target_definition.copy_resources_script_relative_path}"\n}
end
end
end
......
module Pod
class PodPathResolver
include Config::Mixin
def initialize(target_definition)
@target_definition = target_definition
end
def relative_path_for_pods
pods_path = config.project_pods_root
xcode_proj_path = @target_definition.xcodeproj || ''
source_root = (config.project_root + xcode_proj_path).parent
pods_path.relative_path_from(source_root)
end
def pods_root
"$(SRCROOT)/#{relative_path_for_pods}"
end
end
end
......@@ -61,6 +61,16 @@ module Pod
end
end
# Returns a path, which is relative to the project_root, relative to the
# `$(SRCROOT)` of the user's project.
def relative_to_srcroot(path)
(config.project_root + path).relative_path_from(xcodeproj.dirname)
end
def relative_pods_root
"${SRCROOT}/#{relative_to_srcroot "Pods"}"
end
def lib_name
"lib#{label}.a"
end
......@@ -69,10 +79,18 @@ module Pod
"#{label}.xcconfig"
end
def xcconfig_relative_path
relative_to_srcroot("Pods/#{xcconfig_name}").to_s
end
def copy_resources_script_name
"#{label}-resources.sh"
end
def copy_resources_script_relative_path
"${SRCROOT}/#{relative_to_srcroot("Pods/#{copy_resources_script_name}")}"
end
def prefix_header_name
"#{label}-prefix.pch"
end
......@@ -142,7 +160,7 @@ module Pod
else
projects = @target_definitions.map { |_, td| td.xcodeproj }.uniq
if projects.size == 1 && (xcodeproj = @target_definitions[:default].xcodeproj)
xcodeproj.dirname + "#{xcodeproj.basename('.xcodeproj')}.xcworkspace"
config.project_root + "#{xcodeproj.basename('.xcodeproj')}.xcworkspace"
end
end
end
......
......@@ -39,7 +39,7 @@ module Pod
end
def header_search_paths
@header_search_paths.uniq.map { |path| "$(PODS_ROOT)/#{path}" }
@header_search_paths.uniq.map { |path| "${PODS_ROOT}/#{path}" }
end
def prepare_for_install
......
......@@ -47,14 +47,10 @@ describe Pod::Installer::UserProjectIntegrator do
workspace.projpaths.find { |path| path =~ /Pods.xcodeproj/ }.should.not.be.nil
end
it 'adds the Pods xcconfig file to the project' do
@sample_project.files.where(:path => "Pods/Pods.xcconfig").should.not.be.nil
end
it 'sets the Pods xcconfig as the base config for each build configuration' do
@podfile.target_definitions.each do |_, definition|
target = @sample_project.targets.where(:name => definition.link_with.first)
xcconfig_file = @sample_project.files.where(:path => "Pods/#{definition.xcconfig_name}")
xcconfig_file = @sample_project.files.where(:path => "${SRCROOT}/Pods/#{definition.xcconfig_name}")
target.build_configurations.each do |config|
config.base_configuration.should == xcconfig_file
end
......@@ -78,7 +74,7 @@ describe Pod::Installer::UserProjectIntegrator do
@podfile.target_definitions.each do |_, definition|
target = @sample_project.targets.where(:name => definition.link_with.first)
phase = target.shell_script_build_phases.where(:name => "Copy Pods Resources")
phase.shell_script.strip.should == "\"${SRCROOT}/Pods/#{definition.copy_resources_script_name}\"".strip
phase.shell_script.strip.should == "\"${SRCROOT}/Pods/#{definition.copy_resources_script_name}\""
end
end
......
......@@ -86,6 +86,7 @@ else
commit = '2adcd0f81740d6b0cd4589af98790eee3bd1ae7b'
podfile = Pod::Podfile.new do
self.platform :ios
xcodeproj 'dummy'
dependency 'SSToolkit', :git => url, :commit => commit
end
......@@ -103,6 +104,7 @@ else
url = 'https://raw.github.com/gist/1349824/3ec6aa60c19113573fc48eac19d0fafd6a69e033/Reachability.podspec'
podfile = Pod::Podfile.new do
self.platform :ios
xcodeproj 'dummy'
# TODO use a local file instead of http?
dependency 'Reachability', :podspec => url
end
......@@ -120,6 +122,7 @@ else
it "installs a library with a podspec defined inline" do
podfile = Pod::Podfile.new do
self.platform :ios
xcodeproj 'dummy'
dependency do |s|
s.name = 'JSONKit'
s.version = '1.2'
......@@ -150,6 +153,7 @@ else
it "creates targets for different platforms" do
podfile = Pod::Podfile.new do
self.platform :ios
xcodeproj 'dummy'
dependency 'JSONKit', '1.4'
target :ios_target do
# This brings in Reachability on iOS
......@@ -179,6 +183,7 @@ else
podfile = Pod::Podfile.new do
self.platform :ios
xcodeproj 'dummy'
dependency 'JSONKit', '1.4'
dependency 'SSToolkit'
end
......@@ -203,6 +208,7 @@ else
it "runs the optional post_install callback defined in the Podfile _before_ the project is saved to disk" do
podfile = Pod::Podfile.new do
self.platform platform
xcodeproj 'dummy'
dependency 'SSZipArchive'
post_install do |installer|
......@@ -224,6 +230,7 @@ else
it "activates required pods and create a working static library xcode project" do
podfile = Pod::Podfile.new do
self.platform platform
xcodeproj 'dummy'
dependency 'Reachability', '> 2.0.5' if platform == :ios
dependency 'ASIWebPageRequest', '>= 1.8.1'
dependency 'JSONKit', '>= 1.0'
......@@ -268,6 +275,7 @@ else
it "does not activate pods that are only part of other pods" do
spec = Pod::Podfile.new do
self.platform platform
xcodeproj 'dummy'
dependency 'Reachability', '2.0.4' # only 2.0.4 is part of ASIHTTPRequest’s source.
end
......@@ -285,6 +293,7 @@ else
it "adds resources to the xcode copy script" do
spec = Pod::Podfile.new do
self.platform platform
xcodeproj 'dummy'
dependency 'SSZipArchive'
end
......@@ -302,6 +311,7 @@ else
it "overwrites an existing project.pbxproj file" do
spec = Pod::Podfile.new do
self.platform platform
xcodeproj 'dummy'
dependency 'JSONKit'
end
installer = SpecHelper::Installer.new(spec)
......@@ -309,6 +319,7 @@ else
spec = Pod::Podfile.new do
self.platform platform
xcodeproj 'dummy'
dependency 'SSZipArchive'
end
installer = SpecHelper::Installer.new(spec)
......@@ -321,6 +332,7 @@ else
it "creates a project with multiple targets" do
podfile = Pod::Podfile.new do
self.platform platform
xcodeproj 'dummy'
target(:debug) { dependency 'SSZipArchive' }
target(:test, :exclusive => true) { dependency 'JSONKit' }
dependency 'ASIHTTPRequest'
......@@ -388,7 +400,7 @@ else
target = project.targets.first
target.build_configurations.each do |config|
config.base_configuration.path.should == 'Pods/Pods.xcconfig'
config.base_configuration.path.should == '${SRCROOT}/Pods/Pods.xcconfig'
end
target.frameworks_build_phases.first.files.should.include libPods
# should be the last phase
......@@ -398,6 +410,7 @@ else
it "should prevent duplication cleaning headers symlinks with multiple targets" do
podfile = Pod::Podfile.new do
self.platform platform
xcodeproj 'dummy'
target(:debug) { dependency 'SSZipArchive' }
target(:test, :exclusive => true) { dependency 'JSONKit' }
dependency 'ASIHTTPRequest'
......
......@@ -5,17 +5,11 @@ TMP_POD_ROOT = ROOT + "tmp" + "podroot" unless defined? TMP_POD_ROOT
describe Pod::Installer::TargetInstaller do
before do
platform = Pod::Platform.ios
@target_definition = Pod::Podfile::TargetDefinition.new(:foo)
@target_definition.platform = platform
@podfile = stub('podfile',
:platform => platform,
:xcodeproj => 'dummy.xcodeproj',
:generate_bridge_support? => false,
:set_arc_compatibility_flag? => false
)
@podfile = Pod::Podfile.new do
platform :ios
xcodeproj 'dummy'
end
@target_definition = @podfile.target_definitions[:default]
@project = Pod::Project.new
@project.main_group.groups.new('name' => 'Targets Support Files')
......@@ -24,7 +18,7 @@ describe Pod::Installer::TargetInstaller do
@sandbox = Pod::Sandbox.new(TMP_POD_ROOT)
@specification = fixture_spec('banana-lib/BananaLib.podspec')
@pods = [Pod::LocalPod.new(@specification, @sandbox, platform)]
@pods = [Pod::LocalPod.new(@specification, @sandbox, Pod::Platform.ios)]
end
def do_install!
......
......@@ -17,6 +17,7 @@ describe "Pod::Installer" do
before do
@xcconfig = Pod::Installer.new(Pod::Podfile.new do
platform :ios
xcodeproj 'MyProject'
dependency 'JSONKit'
end).target_installers.first.xcconfig.to_hash
end
......
require File.expand_path('../../spec_helper', __FILE__)
describe "Pod::PodPathResolver" do
it "should default to a path underneath source root" do
target_definition = Pod::Podfile::TargetDefinition.new(:default)
target_definition.xcodeproj = 'foo.xcodeproj'
resolver = Pod::PodPathResolver.new(target_definition)
resolver.pods_root.should == "$(SRCROOT)/Pods"
end
it "should work with source root one level deeper" do
target_definition = Pod::Podfile::TargetDefinition.new(:default)
target_definition.xcodeproj = 'subdir/foo.xcodeproj'
resolver = Pod::PodPathResolver.new(target_definition)
resolver.pods_root.should == "$(SRCROOT)/../Pods"
end
end
......@@ -217,12 +217,16 @@ describe "Pod::Podfile" do
it "returns the name of the xcconfig file for the target" do
@podfile.target_definitions[:default].xcconfig_name.should == 'Pods.xcconfig'
@podfile.target_definitions[:default].xcconfig_relative_path.should == 'Pods/Pods.xcconfig'
@podfile.target_definitions[:test].xcconfig_name.should == 'Pods-test.xcconfig'
@podfile.target_definitions[:test].xcconfig_relative_path.should == 'Pods/Pods-test.xcconfig'
end
it "returns the name of the 'copy resources script' file for the target" do
@podfile.target_definitions[:default].copy_resources_script_name.should == 'Pods-resources.sh'
@podfile.target_definitions[:default].copy_resources_script_relative_path.should == '${SRCROOT}/Pods/Pods-resources.sh'
@podfile.target_definitions[:test].copy_resources_script_name.should == 'Pods-test-resources.sh'
@podfile.target_definitions[:test].copy_resources_script_relative_path.should == '${SRCROOT}/Pods/Pods-test-resources.sh'
end
it "returns the name of the 'prefix header' file for the target" do
......@@ -245,6 +249,25 @@ describe "Pod::Podfile" do
@podfile.target_definitions[:osx_target].should.be.exclusive
@podfile.target_definitions[:nested_osx_target].should.not.be.exclusive
end
describe "with an Xcode project that's not in the project_root" do
before do
@target_definition = @podfile.target_definitions[:default]
@target_definition.stubs(:xcodeproj).returns(config.project_root + 'subdir/iOS Project.xcodeproj')
end
it "returns the $(PODS_ROOT) relative to the project's $(SRCROOT)" do
@target_definition.relative_pods_root.should == '${SRCROOT}/../Pods'
end
it "returns the xcconfig file path relative to the project's $(SRCROOT)" do
@target_definition.xcconfig_relative_path.should == '../Pods/Pods.xcconfig'
end
it "returns the 'copy resources script' path relative to the project's $(SRCROOT)" do
@target_definition.copy_resources_script_relative_path.should == '${SRCROOT}/../Pods/Pods-resources.sh'
end
end
end
describe "concerning validations" do
......
......@@ -65,11 +65,11 @@ describe Pod::Sandbox do
File.open(@sandbox.root + path, "w") { |file| file.write('hello') }
end
@sandbox.add_header_files(namespace_path, relative_header_paths)
@sandbox.header_search_paths.should.include("$(PODS_ROOT)/Headers/ExampleLib")
@sandbox.header_search_paths.should.include("${PODS_ROOT}/Headers/ExampleLib")
end
it 'always adds the Headers root to the header search paths' do
@sandbox.header_search_paths.should.include("$(PODS_ROOT)/Headers")
@sandbox.header_search_paths.should.include("${PODS_ROOT}/Headers")
end
it 'clears out its headers root when preparing for install' do
......
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