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

[Library] Add #client_root

Closes #918
parent 6215ab0d
......@@ -179,18 +179,19 @@ module Pod
user_project = Xcodeproj::Project.new(project_path)
targets = compute_user_project_targets(target_definition, user_project)
lib.user_project_path = project_path
lib.user_target_uuids = targets.map(&:uuid)
lib.user_project_path = project_path
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.platform = compute_platform_for_target_definition(target_definition, targets)
lib.platform = compute_platform_for_target_definition(target_definition, targets)
else
unless target_definition.platform
raise Informative, "It is necessary to specify the platform in the Podfile if not integrating."
end
lib.user_project_path = config.installation_root
lib.user_target_uuids = []
lib.client_root = config.installation_root
lib.user_target_uuids = []
lib.user_build_configurations = {}
lib.platform = target_definition.platform
lib.platform = target_definition.platform
end
libraries << lib
end
......
......@@ -53,6 +53,13 @@ module Pod
#
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
# integrate as identified by the analyzer.
#
......@@ -157,7 +164,7 @@ module Pod
# variable of the user's project.
#
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
# @return [String] the path of the xcconfig file relative to the root of
......@@ -189,7 +196,7 @@ module Pod
# @return [String] the computed 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
......@@ -81,6 +81,7 @@ module Pod
lib.support_files_root.should == config.sandbox.root
lib.user_project_path.to_s.should.include 'SampleProject/SampleProject'
lib.client_root.to_s.should.include 'SampleProject'
lib.user_target_uuids.should == ["A346496C14F9BE9A0080D870"]
user_proj = Xcodeproj::Project.new(lib.user_project_path)
user_proj.objects_by_uuid[lib.user_target_uuids.first].name.should == 'SampleProject'
......@@ -92,7 +93,7 @@ module Pod
config.integrate_targets = false
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_build_configurations.should == {}
lib.platform.to_s.should == 'iOS 6.0'
......
......@@ -22,7 +22,8 @@ module Pod
@library = Library.new(@target_definition)
@library.platform = Platform.new(:ios, '6.0')
@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.specs = [@spec]
@library.file_accessors = [file_accessor]
......
......@@ -17,12 +17,12 @@ module Pod
target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.link_with_first_target = true
@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()
@lib.target = pods_project.new_target(:static_library, target_definition.label, :ios)
@lib.user_target_uuids = [@target.uuid]
@lib.support_files_root = config.sandbox.root
@lib.user_project_path = sample_project_path
@target_integrator = TargetIntegrator.new(@lib)
end
......
......@@ -18,6 +18,7 @@ module Pod
end
config.sandbox.project = Project.new()
@library = Library.new(@podfile.target_definitions['Pods'])
@library.client_root = sample_project_path.dirname
@library.user_project_path = sample_project_path
@library.user_target_uuids = ['A346496C14F9BE9A0080D870']
@library.support_files_root = config.sandbox.root
......
......@@ -33,7 +33,7 @@ module Pod
@target_definition.link_with_first_target = true
@lib = Library.new(@target_definition)
@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
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