Commit 0f9ebc5d authored by Fabio Pelosin's avatar Fabio Pelosin

[Installer] Refresh file accessors before linking headers

parent 7cd74f94
...@@ -101,6 +101,7 @@ module Pod ...@@ -101,6 +101,7 @@ module Pod
install_pod_sources install_pod_sources
run_pre_install_hooks run_pre_install_hooks
clean_pod_sources clean_pod_sources
refresh_file_accessors
link_headers link_headers
end end
end end
...@@ -275,6 +276,20 @@ module Pod ...@@ -275,6 +276,20 @@ module Pod
end end
end end
# Reads the file accessors contents from the file system.
#
# @note The contents of the file accessors are modified by the clean
# step of the #{PodSourceInstaller} and by the pre install hooks.
#
# @return [void]
#
def refresh_file_accessors
pod_targets.map(&:file_accessors).flatten.each do |file_accessor|
file_accessor.refresh
end
end
# Creates the link to the headers of the Pod in the sandbox. # Creates the link to the headers of the Pod in the sandbox.
# #
# @return [void] # @return [void]
......
...@@ -129,6 +129,14 @@ module Pod ...@@ -129,6 +129,14 @@ module Pod
# @return [void] # @return [void]
# #
def sync_aggregate_targets def sync_aggregate_targets
# TODO: Clean up dependencies and linking
# TODO: Clean removed targets and their support files
# TODO: Fix sorting of targets
# TODO: Clean unrecognized targets
# TODO: Add integration checks (adding an aggregate target, removing
# one, performing an installation without a project)
# TODO
targets_to_remove = [] targets_to_remove = []
targets_to_install.each do |target| targets_to_install.each do |target|
...@@ -140,24 +148,11 @@ module Pod ...@@ -140,24 +148,11 @@ module Pod
end end
aggregate_targets.each do |target| aggregate_targets.each do |target|
# TODO: increment support files generation
# support_group = project.support_files_group[target.name]
# support_group.remove_from_project if support_group
unless target.target_definition.empty? unless target.target_definition.empty?
gen = SupportFilesGenerator.new(target, sandbox.project) gen = SupportFilesGenerator.new(target, sandbox.project)
gen.generate! gen.generate!
end end
end end
# TODO: clean up dependencies and linking
# TODO: clean removed targets and their support files
# TODO: Fix sorting of targets
# TODO: clean stray and unrecognized targets
# TODO: skip empty aggregate targets
# TODO: Install aggregate targets first
# TODO: sort targets by name before serialization in the project
# TODO: Add integration checks (adding an aggregate target, removing
# one, performing an installation without a project)
end end
...@@ -165,7 +160,6 @@ module Pod ...@@ -165,7 +160,6 @@ module Pod
# #
def add_aggregate_target(target) def add_aggregate_target(target)
UI.message"- Installing `#{target.label}`" do UI.message"- Installing `#{target.label}`" do
# TODO: the support files should be created from scratch in any case
AggregateTargetInstaller.new(sandbox, target).install! AggregateTargetInstaller.new(sandbox, target).install!
end end
end end
...@@ -316,7 +310,7 @@ module Pod ...@@ -316,7 +310,7 @@ module Pod
# #
def pods_to_remove def pods_to_remove
return [] if new_project return [] if new_project
# TODO: Superfluous groups # TODO: Unrecognized groups
@pods_to_remove ||= (sandbox.state.deleted | sandbox.state.changed).sort @pods_to_remove ||= (sandbox.state.deleted | sandbox.state.changed).sort
end end
......
...@@ -29,7 +29,6 @@ module Pod ...@@ -29,7 +29,6 @@ module Pod
# @return [void] # @return [void]
# #
def install! def install!
refresh_file_accessors
add_source_files_references add_source_files_references
add_frameworks_bundles add_frameworks_bundles
add_vendored_libraries add_vendored_libraries
...@@ -42,19 +41,6 @@ module Pod ...@@ -42,19 +41,6 @@ module Pod
# @!group Installation Steps # @!group Installation Steps
#---------------------------------------------------------------------# #---------------------------------------------------------------------#
# Reads the file accessors contents from the file system.
#
# @note The contents of the file accessors are modified by the clean
# step of the #{PodSourceInstaller} and by the pre install hooks.
#
# @return [void]
#
def refresh_file_accessors
file_accessors.each do |fa|
fa.path_list.read_file_system
end
end
# Adds the source files of the Pods to the Pods project. # Adds the source files of the Pods to the Pods project.
# #
# @note The source files are grouped by Pod and in turn by subspec # @note The source files are grouped by Pod and in turn by subspec
......
...@@ -55,17 +55,23 @@ module Pod ...@@ -55,17 +55,23 @@ module Pod
spec_consumer.platform_name spec_consumer.platform_name
end end
# @return [void] Reads the file system to refresh the list of the paths.
#
def refresh
path_list.read_file_system
end
# @return [String] A string suitable for debugging. # @return [String] A string suitable for debugging.
# #
def inspect def inspect
"<#{self.class} spec=#{spec.name} platform=#{platform_name} root=#{root}>" "<#{self.class} spec=#{spec.name} platform=#{platform_name} root=#{root}>"
end end
#-----------------------------------------------------------------------#
public public
# @!group Paths # @!group Paths
#-----------------------------------------------------------------------#
# @return [Array<Pathname>] the source files of the specification. # @return [Array<Pathname>] the source files of the specification.
# #
...@@ -165,11 +171,11 @@ module Pod ...@@ -165,11 +171,11 @@ module Pod
end end
end end
#-----------------------------------------------------------------------#
private private
# @!group Private helpers # @!group Private helpers
#-----------------------------------------------------------------------#
# Returns the list of the paths founds in the file system for the # Returns the list of the paths founds in the file system for the
# attribute with given name. It takes into account any dir pattern and # attribute with given name. It takes into account any dir pattern and
......
...@@ -16,12 +16,6 @@ module Pod ...@@ -16,12 +16,6 @@ module Pod
describe "Installation" do describe "Installation" do
it "adds the files references of the source files the Pods project" do
@file_accessor.path_list.read_file_system
@file_accessor.path_list.expects(:read_file_system)
@sut.install!
end
it "adds the files references of the source files the Pods project" do it "adds the files references of the source files the Pods project" do
@sut.install! @sut.install!
file_ref = config.sandbox.project['Pods/BananaLib/Source Files/Banana.m'] file_ref = config.sandbox.project['Pods/BananaLib/Source Files/Banana.m']
......
...@@ -50,6 +50,7 @@ module Pod ...@@ -50,6 +50,7 @@ module Pod
@installer.stubs(:create_file_accessors) @installer.stubs(:create_file_accessors)
@installer.stubs(:install_pod_sources) @installer.stubs(:install_pod_sources)
@installer.stubs(:link_headers) @installer.stubs(:link_headers)
@installer.stubs(:refresh_file_accessors)
def @installer.run_pre_install_hooks def @installer.run_pre_install_hooks
@hook_called = true @hook_called = true
end end
...@@ -191,6 +192,21 @@ module Pod ...@@ -191,6 +192,21 @@ module Pod
#--------------------------------------# #--------------------------------------#
describe "#refresh_file_accessors" do
it "refreshes the file accessors after cleaning and executing the specification hooks" do
pod_target = PodTarget.new([], nil, config.sandbox)
file_accessor = stub()
pod_target.file_accessors = [file_accessor]
@installer.stubs(:pod_targets).returns([pod_target])
file_accessor.expects(:refresh)
@installer.send(:refresh_file_accessors)
end
end
#--------------------------------------#
describe "#link_headers" do describe "#link_headers" do
it "links the build headers" do it "links the build headers" do
......
...@@ -38,6 +38,11 @@ module Pod ...@@ -38,6 +38,11 @@ module Pod
@accessor.platform_name.should == :ios @accessor.platform_name.should == :ios
end end
it "can be refreshed" do
Sandbox::PathList.any_instance.expects(:read_file_system)
@accessor.refresh
end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
......
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