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
458381c3
Commit
458381c3
authored
Feb 06, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TargetInstaller] Actually link headers.
parent
f25cbfa4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
84 deletions
+81
-84
pod_source_installer.rb
lib/cocoapods/installer/pod_source_installer.rb
+2
-60
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+53
-0
pod_source_installer_spec.rb
spec/unit/installer/pod_source_installer_spec.rb
+0
-24
target_installer_spec.rb
spec/unit/installer/target_installer_spec.rb
+26
-0
No files found.
lib/cocoapods/installer/pod_source_installer.rb
View file @
458381c3
...
...
@@ -38,13 +38,6 @@ module Pod
#-----------------------------------------------------------------------#
extend
DependencyInjection
dependency
:downloader_class
,
Downloader
dependency
:docs_generator_class
,
Generator
::
Documentation
#-----------------------------------------------------------------------#
public
# @!group Configuration
...
...
@@ -95,7 +88,6 @@ module Pod
download_source
unless
predownloaded?
||
local?
generate_docs
if
generate_docs?
clean_installation
if
clean?
&&
!
local?
link_headers
end
# @return [Hash]
...
...
@@ -155,27 +147,6 @@ module Pod
@cleaned
=
true
end
# Creates the link to the headers of the Pod in the sandbox.
#
# @return [void]
#
def
link_headers
headers_sandbox
=
Pathname
.
new
(
root_spec
.
name
)
sandbox
.
build_headers
.
add_search_path
(
headers_sandbox
)
sandbox
.
public_headers
.
add_search_path
(
headers_sandbox
)
file_accessors
.
each
do
|
file_accessor
|
consumer
=
file_accessor
.
spec_consumer
header_mappings
(
headers_sandbox
,
consumer
,
file_accessor
.
headers
).
each
do
|
namespaced_path
,
files
|
sandbox
.
build_headers
.
add_files
(
namespaced_path
,
files
)
end
header_mappings
(
headers_sandbox
,
consumer
,
file_accessor
.
public_headers
).
each
do
|
namespaced_path
,
files
|
sandbox
.
public_headers
.
add_files
(
namespaced_path
,
files
)
end
end
end
#-----------------------------------------------------------------------#
public
...
...
@@ -195,7 +166,7 @@ module Pod
#
def
downloader
return
@downloader
if
@downloader
@downloader
=
self
.
class
.
downloader_class
.
for_target
(
root
,
root_spec
.
source
.
dup
)
@downloader
=
Downloader
.
for_target
(
root
,
root_spec
.
source
.
dup
)
@downloader
.
cache_root
=
CACHE_ROOT
@downloader
.
max_cache_size
=
MAX_CACHE_SIZE
@downloader
.
aggressive_cache
=
aggressive_cache?
...
...
@@ -206,7 +177,7 @@ module Pod
# for generating the documentation.
#
def
documentation_generator
@documentation_generator
||=
self
.
class
.
docs_generator_class
.
new
(
sandbox
,
root_spec
,
path_list
)
@documentation_generator
||=
Generator
::
Documentation
.
new
(
sandbox
,
root_spec
,
path_list
)
end
#-----------------------------------------------------------------------#
...
...
@@ -313,35 +284,6 @@ module Pod
files
end
# Computes the destination sub-directory in the sandbox
#
# @param []
#
# @return [Hash{Pathname => Array<Pathname>}] A hash containing the
# headers folders as the keys and the absolute paths of the
# header files as the values.
#
# TODO This is being overridden in the RestKit 0.9.4 spec and that
# override should be fixed.
#
def
header_mappings
(
headers_sandbox
,
consumer
,
headers
)
dir
=
headers_sandbox
dir
=
dir
+
consumer
.
header_dir
if
consumer
.
header_dir
mappings
=
{}
headers
.
each
do
|
header
|
relative_path
=
header
.
relative_path_from
(
root
)
sub_dir
=
dir
if
consumer
.
header_mappings_dir
sub_dir
=
sub_dir
+
header
.
relative_path_from
(
consumer
.
header_mappings_dir
).
dirname
end
mappings
[
sub_dir
]
||=
[]
mappings
[
sub_dir
]
<<
header
end
mappings
end
#-----------------------------------------------------------------------#
end
...
...
lib/cocoapods/installer/target_installer.rb
View file @
458381c3
...
...
@@ -32,6 +32,7 @@ module Pod
UI
.
message
"- Installing target `
#{
library
.
name
}
`
#{
library
.
platform
}
"
do
add_target
add_files_to_build_phases
link_headers
create_suport_files_group
create_xcconfig_file
...
...
@@ -120,6 +121,30 @@ module Pod
end
end
# Creates the link to the headers of the Pod in the sandbox.
#
# @return [void]
#
def
link_headers
UI
.
message
"- Linking headers"
do
library
.
file_accessors
.
each
do
|
file_accessor
|
headers_sandbox
=
Pathname
.
new
(
file_accessor
.
spec
.
root
.
name
)
sandbox
.
build_headers
.
add_search_path
(
headers_sandbox
)
sandbox
.
public_headers
.
add_search_path
(
headers_sandbox
)
consumer
=
file_accessor
.
spec_consumer
header_mappings
(
headers_sandbox
,
consumer
,
file_accessor
.
headers
,
file_accessor
.
path_list
.
root
).
each
do
|
namespaced_path
,
files
|
sandbox
.
build_headers
.
add_files
(
namespaced_path
,
files
)
end
header_mappings
(
headers_sandbox
,
consumer
,
file_accessor
.
public_headers
,
file_accessor
.
path_list
.
root
).
each
do
|
namespaced_path
,
files
|
sandbox
.
public_headers
.
add_files
(
namespaced_path
,
files
)
end
end
end
end
# Creates the group that holds the references to the support files
# generated by this installer.
#
...
...
@@ -364,6 +389,34 @@ module Pod
flags
=
flags
*
" "
end
# Computes the destination sub-directory in the sandbox
#
# @param []
#
# @return [Hash{Pathname => Array<Pathname>}] A hash containing the
# headers folders as the keys and the absolute paths of the
# header files as the values.
#
# TODO This is being overridden in the RestKit 0.9.4 spec and that
# override should be fixed.
#
def
header_mappings
(
headers_sandbox
,
consumer
,
headers
,
root
)
dir
=
headers_sandbox
dir
=
dir
+
consumer
.
header_dir
if
consumer
.
header_dir
mappings
=
{}
headers
.
each
do
|
header
|
relative_path
=
header
.
relative_path_from
(
root
)
sub_dir
=
dir
if
consumer
.
header_mappings_dir
sub_dir
=
sub_dir
+
header
.
relative_path_from
(
consumer
.
header_mappings_dir
).
dirname
end
mappings
[
sub_dir
]
||=
[]
mappings
[
sub_dir
]
<<
header
end
mappings
end
#-----------------------------------------------------------------------#
end
...
...
spec/unit/installer/pod_source_installer_spec.rb
View file @
458381c3
...
...
@@ -118,30 +118,6 @@ module Pod
#--------------------------------------#
describe
"Headers"
do
it
"links the headers used to build the Pod library"
do
@installer
.
install!
headers_root
=
config
.
sandbox
.
build_headers
.
root
public_header
=
headers_root
+
'BananaLib/Banana.h'
private_header
=
headers_root
+
'BananaLib/BananaPrivate.h'
public_header
.
should
.
exist
private_header
.
should
.
exist
end
it
"links the public headers"
do
@installer
.
install!
headers_root
=
config
.
sandbox
.
public_headers
.
root
public_header
=
headers_root
+
'BananaLib/Banana.h'
private_header
=
headers_root
+
'BananaLib/BananaPrivate.h'
public_header
.
should
.
exist
private_header
.
should
.
not
.
exist
end
end
#--------------------------------------#
describe
"Options"
do
it
"doesn't downloads the source if the pod was already downloaded"
do
...
...
spec/unit/installer/target_installer_spec.rb
View file @
458381c3
...
...
@@ -212,6 +212,32 @@ module Pod
#--------------------------------------------------------------------------------#
#--------------------------------------#
describe
"Headers"
do
it
"links the headers used to build the Pod library"
do
@installer
.
install!
headers_root
=
config
.
sandbox
.
build_headers
.
root
public_header
=
headers_root
+
'BananaLib/Banana.h'
private_header
=
headers_root
+
'BananaLib/BananaPrivate.h'
public_header
.
should
.
exist
private_header
.
should
.
exist
end
it
"links the public headers"
do
@installer
.
install!
headers_root
=
config
.
sandbox
.
public_headers
.
root
public_header
=
headers_root
+
'BananaLib/Banana.h'
private_header
=
headers_root
+
'BananaLib/BananaPrivate.h'
public_header
.
should
.
exist
private_header
.
should
.
not
.
exist
end
end
#--------------------------------------#
describe
"concerning ARC before and after iOS 6.0 and OS X 10.8"
do
before
do
@spec
=
Pod
::
Spec
.
new
...
...
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