Commit 10218d3d authored by Fabio Pelosin's avatar Fabio Pelosin

[Library] Add #client_root

Closes #918
parent 6215ab0d
...@@ -179,18 +179,19 @@ module Pod ...@@ -179,18 +179,19 @@ module Pod
user_project = Xcodeproj::Project.new(project_path) user_project = Xcodeproj::Project.new(project_path)
targets = compute_user_project_targets(target_definition, user_project) targets = compute_user_project_targets(target_definition, user_project)
lib.user_project_path = project_path lib.user_project_path = project_path
lib.user_target_uuids = targets.map(&:uuid) lib.client_root = project_path.dirname
lib.user_target_uuids = targets.map(&:uuid)
lib.user_build_configurations = compute_user_build_configurations(target_definition, targets) lib.user_build_configurations = compute_user_build_configurations(target_definition, targets)
lib.platform = compute_platform_for_target_definition(target_definition, targets) lib.platform = compute_platform_for_target_definition(target_definition, targets)
else else
unless target_definition.platform unless target_definition.platform
raise Informative, "It is necessary to specify the platform in the Podfile if not integrating." raise Informative, "It is necessary to specify the platform in the Podfile if not integrating."
end end
lib.user_project_path = config.installation_root lib.client_root = config.installation_root
lib.user_target_uuids = [] lib.user_target_uuids = []
lib.user_build_configurations = {} lib.user_build_configurations = {}
lib.platform = target_definition.platform lib.platform = target_definition.platform
end end
libraries << lib libraries << lib
end end
......
...@@ -53,6 +53,13 @@ module Pod ...@@ -53,6 +53,13 @@ module Pod
# #
attr_accessor :support_files_root attr_accessor :support_files_root
# @return [Pathname] the folder where the client is stored used for
# computing the relative paths. If integrating it should be the
# folder where the user project is stored, otherwise it should
# be the installation root.
#
attr_accessor :client_root
# @return [Pathname] the path of the user project that this library will # @return [Pathname] the path of the user project that this library will
# integrate as identified by the analyzer. # integrate as identified by the analyzer.
# #
...@@ -157,7 +164,7 @@ module Pod ...@@ -157,7 +164,7 @@ module Pod
# variable of the user's project. # variable of the user's project.
# #
def relative_pods_root def relative_pods_root
"${SRCROOT}/#{support_files_root.relative_path_from(user_project_path.dirname)}" "${SRCROOT}/#{support_files_root.relative_path_from(client_root)}"
end end
# @return [String] the path of the xcconfig file relative to the root of # @return [String] the path of the xcconfig file relative to the root of
...@@ -189,7 +196,7 @@ module Pod ...@@ -189,7 +196,7 @@ module Pod
# @return [String] the computed path. # @return [String] the computed path.
# #
def relative_to_srcroot(path) def relative_to_srcroot(path)
path.relative_path_from(user_project_path.dirname).to_s path.relative_path_from(client_root).to_s
end end
end end
end end
...@@ -81,6 +81,7 @@ module Pod ...@@ -81,6 +81,7 @@ module Pod
lib.support_files_root.should == config.sandbox.root lib.support_files_root.should == config.sandbox.root
lib.user_project_path.to_s.should.include 'SampleProject/SampleProject' lib.user_project_path.to_s.should.include 'SampleProject/SampleProject'
lib.client_root.to_s.should.include 'SampleProject'
lib.user_target_uuids.should == ["A346496C14F9BE9A0080D870"] lib.user_target_uuids.should == ["A346496C14F9BE9A0080D870"]
user_proj = Xcodeproj::Project.new(lib.user_project_path) user_proj = Xcodeproj::Project.new(lib.user_project_path)
user_proj.objects_by_uuid[lib.user_target_uuids.first].name.should == 'SampleProject' user_proj.objects_by_uuid[lib.user_target_uuids.first].name.should == 'SampleProject'
...@@ -92,7 +93,7 @@ module Pod ...@@ -92,7 +93,7 @@ module Pod
config.integrate_targets = false config.integrate_targets = false
lib = @analyzer.analyze.libraries.first lib = @analyzer.analyze.libraries.first
lib.user_project_path.should == config.installation_root lib.client_root.should == config.installation_root
lib.user_target_uuids.should == [] lib.user_target_uuids.should == []
lib.user_build_configurations.should == {} lib.user_build_configurations.should == {}
lib.platform.to_s.should == 'iOS 6.0' lib.platform.to_s.should == 'iOS 6.0'
......
...@@ -22,7 +22,8 @@ module Pod ...@@ -22,7 +22,8 @@ module Pod
@library = Library.new(@target_definition) @library = Library.new(@target_definition)
@library.platform = Platform.new(:ios, '6.0') @library.platform = Platform.new(:ios, '6.0')
@library.support_files_root = config.sandbox.root @library.support_files_root = config.sandbox.root
@library.user_project_path = config.sandbox.root + '../user_project.xcodeproj' @library.client_root = config.sandbox.root.dirname
@library.user_project_path = config.sandbox.root + '../user_project.xcodeproj'
@library.user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug } @library.user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug }
@library.specs = [@spec] @library.specs = [@spec]
@library.file_accessors = [file_accessor] @library.file_accessors = [file_accessor]
......
...@@ -17,12 +17,12 @@ module Pod ...@@ -17,12 +17,12 @@ module Pod
target_definition = Podfile::TargetDefinition.new('Pods', nil) target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.link_with_first_target = true target_definition.link_with_first_target = true
@lib = Library.new(target_definition) @lib = Library.new(target_definition)
@lib.user_project_path = sample_project_path @lib.user_project_path = sample_project_path
@lib.client_root = sample_project_path.dirname
pods_project = Project.new() pods_project = Project.new()
@lib.target = pods_project.new_target(:static_library, target_definition.label, :ios) @lib.target = pods_project.new_target(:static_library, target_definition.label, :ios)
@lib.user_target_uuids = [@target.uuid] @lib.user_target_uuids = [@target.uuid]
@lib.support_files_root = config.sandbox.root @lib.support_files_root = config.sandbox.root
@lib.user_project_path = sample_project_path
@target_integrator = TargetIntegrator.new(@lib) @target_integrator = TargetIntegrator.new(@lib)
end end
......
...@@ -18,6 +18,7 @@ module Pod ...@@ -18,6 +18,7 @@ module Pod
end end
config.sandbox.project = Project.new() config.sandbox.project = Project.new()
@library = Library.new(@podfile.target_definitions['Pods']) @library = Library.new(@podfile.target_definitions['Pods'])
@library.client_root = sample_project_path.dirname
@library.user_project_path = sample_project_path @library.user_project_path = sample_project_path
@library.user_target_uuids = ['A346496C14F9BE9A0080D870'] @library.user_target_uuids = ['A346496C14F9BE9A0080D870']
@library.support_files_root = config.sandbox.root @library.support_files_root = config.sandbox.root
......
...@@ -33,7 +33,7 @@ module Pod ...@@ -33,7 +33,7 @@ module Pod
@target_definition.link_with_first_target = true @target_definition.link_with_first_target = true
@lib = Library.new(@target_definition) @lib = Library.new(@target_definition)
@lib.support_files_root = config.sandbox.root @lib.support_files_root = config.sandbox.root
@lib.user_project_path = config.sandbox.root + '../user_project.xcodeproj' @lib.client_root = config.sandbox.root.dirname
end end
it "returns the absolute path of the xcconfig file" do it "returns the absolute path of the xcconfig file" 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