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
93a134ed
Commit
93a134ed
authored
Feb 15, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FileReferencesInstaller] Link headers globally, for now.
parent
09e97fba
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
85 deletions
+77
-85
file_references_installer.rb
lib/cocoapods/installer/file_references_installer.rb
+54
-0
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+4
-59
file_references_installer_spec.rb
spec/unit/installer/file_references_installer_spec.rb
+19
-0
target_installer_spec.rb
spec/unit/installer/target_installer_spec.rb
+0
-26
No files found.
lib/cocoapods/installer/file_references_installer.rb
View file @
93a134ed
...
...
@@ -35,6 +35,7 @@ module Pod
def
install!
add_source_files_references
add_resources_references
link_headers
end
#-----------------------------------------------------------------------#
...
...
@@ -90,6 +91,32 @@ module Pod
end
end
# Creates the link to the headers of the Pod in the sandbox.
#
# TODO: clean up
#
# @return [void]
#
def
link_headers
UI
.
message
"- Linking headers"
do
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
#-----------------------------------------------------------------------#
private
...
...
@@ -103,6 +130,33 @@ module Pod
@file_accessors
||=
libraries
.
map
(
&
:file_accessors
).
flatten
.
compact
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
|
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 @
93a134ed
...
...
@@ -32,7 +32,6 @@ 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
...
...
@@ -78,10 +77,10 @@ module Pod
@target
.
build_settings
(
'Debug'
).
merge!
(
settings
)
@target
.
build_settings
(
'Release'
).
merge!
(
settings
)
library
.
user_build_configurations
.
each
do
|
name
,
type
|
unless
@target
.
build_configurations
.
map
(
&
:name
).
include?
(
name
)
library
.
user_build_configurations
.
each
do
|
lib_
name
,
type
|
unless
@target
.
build_configurations
.
map
(
&
:name
).
include?
(
lib_
name
)
build_config
=
project
.
new
(
Xcodeproj
::
Project
::
XCBuildConfiguration
)
build_config
.
name
=
name
build_config
.
name
=
lib_
name
settings
=
@target
.
build_settings
(
type
.
to_s
.
capitalize
)
build_config
.
build_settings
=
settings
target
.
build_configurations
<<
build_config
...
...
@@ -115,33 +114,7 @@ module Pod
target
.
add_file_references
(
file_refs
,
flags
)
file_accessor
.
spec_consumer
.
frameworks
.
each
do
|
framework
|
framework_ref
=
project
.
add_system_framework
(
framework
,
target
)
end
end
end
end
# Creates the link to the headers of the Pod in the sandbox.
#
# TODO: clean up
#
# @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
)
project
.
add_system_framework
(
framework
,
target
)
end
end
end
...
...
@@ -391,34 +364,6 @@ 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/file_references_installer_spec.rb
View file @
93a134ed
...
...
@@ -32,6 +32,25 @@ module Pod
file_ref
.
should
.
be
.
not
.
nil
file_ref
.
path
.
should
==
"../../spec/fixtures/banana-lib/Resources/logo-sidebar.png"
end
it
"links the build headers"
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
#-------------------------------------------------------------------------#
...
...
spec/unit/installer/target_installer_spec.rb
View file @
93a134ed
...
...
@@ -212,32 +212,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
"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