Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
0f9ebc5d
Commit
0f9ebc5d
authored
Sep 09, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Installer] Refresh file accessors before linking headers
parent
7cd74f94
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
53 additions
and
37 deletions
+53
-37
installer.rb
lib/cocoapods/installer.rb
+15
-0
pods_project_generator.rb
lib/cocoapods/installer/pods_project_generator.rb
+9
-15
file_references_installer.rb
...aller/pods_project_generator/file_references_installer.rb
+0
-14
file_accessor.rb
lib/cocoapods/sandbox/file_accessor.rb
+8
-2
file_references_installer_spec.rb
.../pods_project_generator/file_references_installer_spec.rb
+0
-6
installer_spec.rb
spec/unit/installer_spec.rb
+16
-0
file_accessor_spec.rb
spec/unit/sandbox/file_accessor_spec.rb
+5
-0
No files found.
lib/cocoapods/installer.rb
View file @
0f9ebc5d
...
@@ -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]
...
...
lib/cocoapods/installer/pods_project_generator.rb
View file @
0f9ebc5d
...
@@ -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
...
...
lib/cocoapods/installer/pods_project_generator/file_references_installer.rb
View file @
0f9ebc5d
...
@@ -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
...
...
lib/cocoapods/sandbox/file_accessor.rb
View file @
0f9ebc5d
...
@@ -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
...
...
spec/unit/installer/pods_project_generator/file_references_installer_spec.rb
View file @
0f9ebc5d
...
@@ -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'
]
...
...
spec/unit/installer_spec.rb
View file @
0f9ebc5d
...
@@ -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
...
...
spec/unit/sandbox/file_accessor_spec.rb
View file @
0f9ebc5d
...
@@ -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
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment