Commit b0df36df authored by Fabio Pelosin's avatar Fabio Pelosin

[Installer] Rename #targets to #aggregate_targets

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