Commit b0df36df authored by Fabio Pelosin's avatar Fabio Pelosin

[Installer] Rename #targets to #aggregate_targets

parent d7f9903d
......@@ -70,7 +70,7 @@ module Pod
#
def pods_by_lib
result = {}
installer.targets.map(&:pod_targets).flatten.each do |lib|
installer.aggregate_targets.map(&:pod_targets).flatten.each do |lib|
pod_names = [lib.root_spec.name]
pod_reps = pods.select { |rep| pod_names.include?(rep.name) }
result[lib.target_definition] = pod_reps
......
......@@ -111,7 +111,7 @@ module Pod
prepare_pods_project
install_file_references
install_libraries
link_integration_libraries
link_aggregate_target
run_post_install_hooks
write_pod_project
write_lockfiles
......@@ -140,7 +140,7 @@ module Pod
# @return [Array<AggregateTarget>] The Podfile targets containing library
# dependencies.
#
attr_reader :targets
attr_reader :aggregate_targets
# @return [Array<Specification>] The specifications that where installed.
#
......@@ -168,7 +168,7 @@ module Pod
analyzer = Analyzer.new(sandbox, podfile, lockfile)
analyzer.update_mode = update_mode
@analysis_result = analyzer.analyze
@targets = analyzer.result.targets
@aggregate_targets = analyzer.result.targets
end
# Prepares the Pods folder in order to be compatible with the most recent
......@@ -208,7 +208,7 @@ module Pod
# created by the Pod source installer as well.
#
def create_file_accessors
targets.each do |target|
aggregate_targets.each do |target|
target.pod_targets.each do |pod_target|
pod_root = sandbox.pod_dir(pod_target.root_spec.name)
path_list = Sandbox::PathList.new(pod_root)
......@@ -289,7 +289,7 @@ module Pod
@pods_project.add_podfile(config.podfile_path)
end
sandbox.project = @pods_project
platforms = targets.map(&:platform)
platforms = aggregate_targets.map(&:platform)
osx_deployment_target = platforms.select { |p| p.name == :osx }.map(&:deployment_target).min
ios_deployment_target = platforms.select { |p| p.name == :ios }.map(&:deployment_target).min
@pods_project.build_configurations.each do |build_configuration|
......@@ -301,7 +301,8 @@ module Pod
# Installs the file references in the Pods project. This is done once per
# Pod as the same file reference might be shared by multiple targets.
# Pod as the same file reference might be shared by multiple aggregate
# targets.
#
# @return [void]
#
......@@ -310,7 +311,7 @@ module Pod
installer.install!
end
# Installs the library targets of the Pods projects and generates their
# Installs the aggregate targets of the Pods projects and generates their
# support files.
#
# @return [void]
......@@ -323,7 +324,7 @@ module Pod
target_installer.install!
end
targets.sort_by(&:name).each do |target|
aggregate_targets.sort_by(&:name).each do |target|
next if target.target_definition.empty?
target_installer = AggregateTargetInstaller.new(sandbox, target)
target_installer.install!
......@@ -331,16 +332,16 @@ module Pod
end
end
# Links the integration library targets with all the dependent libraries
# Links the aggregate targets with all the dependent libraries.
#
# @note This is run in the integration step to ensure that targets
# have been created for all per spec libraries.
#
def link_integration_libraries
targets.each do |target|
native_target = pods_project.targets.select { |t| t.name == target.name }.first
def link_aggregate_target
aggregate_targets.each do |aggregate_target|
native_target = pods_project.targets.select { |t| t.name == aggregate_target.name }.first
products = pods_project.products_group
target.pod_targets.each do |pod_target|
aggregate_target.pod_targets.each do |pod_target|
product = products.files.select { |f| f.path == pod_target.product_name }.first
native_target.frameworks_build_phase.add_file_reference(product)
end
......@@ -391,9 +392,9 @@ module Pod
# information in the lockfile.
#
def integrate_user_project
UI.section "Integrating client #{'project'.pluralize(targets.map(&:user_project_path).uniq.count) }" do
UI.section "Integrating client #{'project'.pluralize(aggregate_targets.map(&:user_project_path).uniq.count) }" do
installation_root = config.installation_root
integrator = UserProjectIntegrator.new(podfile, sandbox, installation_root, targets)
integrator = UserProjectIntegrator.new(podfile, sandbox, installation_root, aggregate_targets)
integrator.integrate!
end
end
......@@ -577,7 +578,7 @@ module Pod
# process.
#
def pod_targets
targets.map(&:pod_targets).flatten
aggregate_targets.map(&:pod_targets).flatten
end
#-------------------------------------------------------------------------#
......
......@@ -208,7 +208,7 @@ module Pod
installer = Installer.new(sandbox, podfile)
installer.install!
file_accessors = installer.targets.first.pod_targets.first.file_accessors
file_accessors = installer.aggregate_targets.first.pod_targets.first.file_accessors
@file_accessor = file_accessors.find { |accessor| accessor.spec == spec }
config.silent
end
......
......@@ -16,7 +16,7 @@ module Pod
config.integrate_targets = false
@installer = Installer.new(config.sandbox, podfile)
@installer.send(:analyze)
@specs = @installer.targets.first.pod_targets.first.specs
@specs = @installer.aggregate_targets.first.pod_targets.first.specs
@installer.stubs(:installed_specs).returns(@specs)
@rep = Hooks::InstallerRepresentation.new(@installer)
end
......@@ -52,7 +52,7 @@ module Pod
it "returns the pods representation by library representation" do
pods_by_lib = @rep.pods_by_lib
target_definition = @installer.targets.first.pod_targets.first.target_definition
target_definition = @installer.aggregate_targets.first.pod_targets.first.target_definition
pods_by_lib[target_definition].map(&:name).should == ['JSONKit']
end
......
......@@ -62,7 +62,7 @@ module Pod
@installer.stubs(:run_pre_install_hooks)
@installer.stubs(:install_file_references)
@installer.stubs(:install_libraries)
@installer.stubs(:link_integration_libraries)
@installer.stubs(:link_aggregate_target)
@installer.stubs(:write_lockfiles)
@installer.unstub(:generate_pods_project)
def @installer.run_post_install_hooks
......@@ -107,7 +107,7 @@ module Pod
it "stores the targets created by the analyzer" do
@installer.send(:analyze)
@installer.targets.map(&:name).sort.should == ['Pods']
@installer.aggregate_targets.map(&:name).sort.should == ['Pods']
@installer.pod_targets.map(&:name).sort.should == ['Pods-JSONKit']
end
......@@ -115,7 +115,7 @@ module Pod
@installer.update_mode = true
Installer::Analyzer.any_instance.expects(:update_mode=).with(true)
@installer.send(:analyze)
@installer.targets.map(&:name).sort.should == ['Pods']
@installer.aggregate_targets.map(&:name).sort.should == ['Pods']
@installer.pod_targets.map(&:name).sort.should == ['Pods-JSONKit']
end
......@@ -217,13 +217,13 @@ module Pod
describe "#prepare_pods_project" do
it "creates the Pods project" do
@installer.stubs(:targets).returns([])
@installer.stubs(:aggregate_targets).returns([])
@installer.send(:prepare_pods_project)
@installer.pods_project.class.should == Pod::Project
end
it "adds the Podfile to the Pods project" do
@installer.stubs(:targets).returns([])
@installer.stubs(:aggregate_targets).returns([])
config.stubs(:podfile_path).returns(Pathname.new('/Podfile'))
@installer.send(:prepare_pods_project)
f = @installer.pods_project['Podfile']
......@@ -235,7 +235,7 @@ module Pod
pod_target_osx = PodTarget.new([], nil, config.sandbox)
pod_target_ios.stubs(:platform).returns(Platform.new(:ios, '6.0'))
pod_target_osx.stubs(:platform).returns(Platform.new(:osx, '10.8'))
@installer.stubs(:targets).returns([pod_target_ios, pod_target_osx])
@installer.stubs(:aggregate_targets).returns([pod_target_ios, pod_target_osx])
@installer.send(:prepare_pods_project)
build_settings = @installer.pods_project.build_configurations.map(&:build_settings)
build_settings.should == [
......@@ -266,7 +266,7 @@ module Pod
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.store_pod('BananaLib')
pod_target = PodTarget.new([spec], target_definition, config.sandbox)
@installer.stubs(:targets).returns([])
@installer.stubs(:aggregate_targets).returns([])
@installer.stubs(:pod_targets).returns([pod_target])
Installer::PodTargetInstaller.any_instance.expects(:install!)
@installer.send(:install_libraries)
......@@ -276,7 +276,7 @@ module Pod
spec = fixture_spec('banana-lib/BananaLib.podspec')
target_definition = Podfile::TargetDefinition.new(:default, nil)
pod_target = PodTarget.new([spec], target_definition, config.sandbox)
@installer.stubs(:targets).returns([])
@installer.stubs(:aggregate_targets).returns([])
@installer.stubs(:pod_targets).returns([pod_target])
Installer::PodTargetInstaller.any_instance.expects(:install!).never
@installer.send(:install_libraries)
......@@ -289,7 +289,7 @@ module Pod
describe "#write_pod_project" do
before do
@installer.stubs(:targets).returns([])
@installer.stubs(:aggregate_targets).returns([])
@installer.send(:prepare_pods_project)
end
......@@ -359,15 +359,15 @@ module Pod
pods_target = project.new_target(:static_library, target.name, :ios)
native_target = project.new_target(:static_library, pod_target.name, :ios)
@installer.stubs(:pods_project).returns(project)
@installer.stubs(:targets).returns([target])
@installer.stubs(:aggregate_targets).returns([target])
@installer.stubs(:pod_targets).returns([pod_target])
@installer.send(:link_integration_libraries)
@installer.send(:link_aggregate_target)
pods_target.frameworks_build_phase.files.map(&:display_name).should.include?(pod_target.product_name)
end
it "integrates the client projects" do
@installer.stubs(:targets).returns([AggregateTarget.new(nil, config.sandbox)])
@installer.stubs(:aggregate_targets).returns([AggregateTarget.new(nil, config.sandbox)])
Installer::UserProjectIntegrator.any_instance.expects(:integrate!)
@installer.send(:integrate_user_project)
end
......@@ -383,7 +383,7 @@ module Pod
@specs = @installer.pod_targets.map(&:specs).flatten
@spec = @specs.find { |spec| spec && spec.name == 'JSONKit' }
@installer.stubs(:installed_specs).returns(@specs)
@lib = @installer.targets.first.pod_targets.first
@lib = @installer.aggregate_targets.first.pod_targets.first
end
it "runs the pre install hooks" 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