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
68f22d19
Commit
68f22d19
authored
Aug 06, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#221] Completed merge.
parent
d0a215c7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
57 deletions
+49
-57
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+1
-1
local_pod.rb
lib/cocoapods/local_pod.rb
+18
-10
sandbox.rb
lib/cocoapods/sandbox.rb
+2
-2
specification.rb
lib/cocoapods/specification.rb
+1
-0
spec_spec.rb
spec/functional/command/spec_spec.rb
+1
-1
local_pod_spec.rb
spec/unit/local_pod_spec.rb
+11
-32
sandbox_spec.rb
spec/unit/sandbox_spec.rb
+15
-11
No files found.
lib/cocoapods/installer/target_installer.rb
View file @
68f22d19
...
...
@@ -72,7 +72,7 @@ module Pod
end
@target
.
add_source_files
(
source_file_descriptions
)
xcconfig
.
merge!
(
'HEADER_SEARCH_PATHS'
=>
quoted
(
sandbox
.
header_
search_paths
).
join
(
" "
))
xcconfig
.
merge!
(
'HEADER_SEARCH_PATHS'
=>
quoted
(
sandbox
.
build_headers
.
search_paths
).
join
(
" "
))
# Indirect HEADER_SEARCH_PATHS, so that configure_build_configurations can override it
xcconfig
.
merge!
(
'PODS_HEADER_SEARCH_PATHS'
=>
quoted
(
sandbox
.
public_headers
.
search_paths
).
join
(
" "
))
...
...
lib/cocoapods/local_pod.rb
View file @
68f22d19
...
...
@@ -229,14 +229,22 @@ module Pod
result
end
# TODO: complete, fix and comment
# @return [Hash{Specification => Array<Pathname>}] The paths of the public
# header files grouped by {Specification}.
#
# @TODO: complete, fix and comment
# @TODO: decide a policy for subspecs
#
def
public_header_files_by_specs
if
specification
.
public_header_files
.
empty?
header_files_by_spec
else
options
=
{
:glob
=>
'*.h'
}
paths_by_spec
(
:source_files
,
options
)
cached_header_files_by_spec
=
header_files_by_spec
public_header_files
=
paths_by_spec
(
:source_files
,
:glob
=>
'*.h'
)
result
=
{}
public_header_files
.
map
do
|
spec
,
paths
|
result
[
spec
]
=
paths
.
empty?
?
cached_header_files_by_spec
[
spec
]
:
paths
end
result
end
# @return [Array<Pathname>] The paths of the resources.
...
...
@@ -332,14 +340,14 @@ module Pod
# @return [void] Copies the pods headers to the sandbox.
#
def
link_headers
@sandbox
.
add_header_search_path
(
headers_sandbox
)
@sandbox
.
build_headers
.
add_search_path
(
headers_sandbox
)
header_mappings
.
each
do
|
namespaced_path
,
files
|
@sandbox
.
build_header
_storage
.
add_files
(
namespaced_path
,
files
)
@sandbox
.
build_header
s
.
add_files
(
namespaced_path
,
files
)
end
@sandbox
.
public_headers
.
add_search_path
(
headers_sandbox
)
public_header_mappings
.
each
do
|
namespaced_path
,
files
|
@sandbox
.
public_header
_storage
.
add_files
(
namespaced_path
,
files
)
@sandbox
.
public_header
s
.
add_files
(
namespaced_path
,
files
)
end
end
...
...
lib/cocoapods/sandbox.rb
View file @
68f22d19
...
...
@@ -87,8 +87,8 @@ module Pod
#
# @return [void]
#
def
add_
header_
search_path
(
path
)
@
header_search_paths
<<
Pathname
.
new
(
HEADERS_DIR
)
+
path
def
add_search_path
(
path
)
@
search_paths
<<
path
end
def
prepare_for_install
...
...
lib/cocoapods/specification.rb
View file @
68f22d19
...
...
@@ -40,6 +40,7 @@ module Pod
# multi-platform attributes
%w[ source_files
public_header_files
resources
preserve_paths
exclude_header_search_paths
...
...
spec/functional/command/spec_spec.rb
View file @
68f22d19
...
...
@@ -34,7 +34,7 @@ describe "Pod::Command::Spec#create" do
spec
.
source
.
should
==
{
:git
=>
'http://EXAMPLE/Bananas.git'
,
:tag
=>
'0.0.1'
}
spec
.
description
.
should
==
'A short description of Bananas.'
spec
.
source_files
.
should
==
[
'Classes'
,
'Classes/**/*.{h,m}'
]
spec
.
public_header_files
[
:ios
]
.
should
==
[]
spec
.
public_header_files
.
should
==
[]
end
it
"correctly creates a podspec from github"
do
...
...
spec/unit/local_pod_spec.rb
View file @
68f22d19
...
...
@@ -11,26 +11,6 @@ describe Pod::LocalPod do
copy_fixture_to_pod
(
'banana-lib'
,
@pod
)
end
it
"can link it's headers into the sandbox"
do
@pod
.
link_headers
expected_header_path
=
@sandbox
.
build_headers
.
root
+
"BananaLib/Banana.h"
expected_header_path
.
should
.
be
.
symlink
File
.
read
(
expected_header_path
).
should
==
(
@sandbox
.
root
+
@pod
.
header_files
[
0
]).
read
end
it
"can add it's source files to an Xcode project target"
do
target
=
mock
(
'target'
)
target
.
expects
(
:add_source_file
).
with
(
Pathname
.
new
(
"BananaLib/Classes/Banana.m"
),
anything
,
anything
)
@pod
.
add_to_target
(
target
)
end
it
"can add it's source files to a target with any specially configured compiler flags"
do
@pod
.
specification
.
compiler_flags
=
'-d some_flag'
target
=
mock
(
'target'
)
target
.
expects
(
:add_source_file
).
with
(
anything
,
anything
,
"-d some_flag"
)
@pod
.
add_to_target
(
target
)
end
it
'returns the Pod root directory path'
do
@pod
.
root
.
should
==
@sandbox
.
root
+
'BananaLib'
end
...
...
@@ -70,16 +50,6 @@ describe Pod::LocalPod do
@pod
.
relative_header_files
.
should
==
[
Pathname
.
new
(
"BananaLib/Classes/Banana.h"
)]
end
xit
"returns the user header search paths"
do
def
@spec
.
copy_header_mapping
(
from
)
Pathname
.
new
(
'ns'
)
+
from
.
basename
end
@spec
.
build_headers
.
search_paths
.
should
==
%w{
"$(PODS_ROOT)/Headers/SSZipArchive"
"$(PODS_ROOT)/Headers/SSZipArchive/ns"
}
end
it
'returns a list of header files by specification'
do
files
=
@pod
.
header_files_by_spec
[
@pod
.
specifications
.
first
].
sort
files
.
should
==
[
@pod
.
root
+
"Classes/Banana.h"
]
...
...
@@ -100,7 +70,14 @@ describe Pod::LocalPod do
it
"can link it's headers into the sandbox"
do
@pod
.
link_headers
expected_header_path
=
@sandbox
.
headers_root
+
"BananaLib/Banana.h"
expected_header_path
=
@sandbox
.
build_headers
.
root
+
"BananaLib/Banana.h"
expected_header_path
.
should
.
be
.
symlink
File
.
read
(
expected_header_path
).
should
==
(
@sandbox
.
root
+
@pod
.
header_files
[
0
]).
read
end
it
"can link it's public headers into the sandbox"
do
@pod
.
link_headers
expected_header_path
=
@sandbox
.
public_headers
.
root
+
"BananaLib/Banana.h"
expected_header_path
.
should
.
be
.
symlink
File
.
read
(
expected_header_path
).
should
==
(
@sandbox
.
root
+
@pod
.
header_files
[
0
]).
read
end
...
...
@@ -321,8 +298,10 @@ describe Pod::LocalPod do
"Chameleon/UIKit > UIKit/Classes/UIView.h UIKit/Classes/UIWindow.h"
]
end
# This is done by the sandbox and this test should be moved
it
"includes the sandbox of the pod's headers while linking"
do
@sandbox
.
expects
(
:add_header_search_path
).
with
(
Pathname
.
new
(
'Chameleon'
))
@sandbox
.
build_headers
.
expects
(
:add_search_path
).
with
(
Pathname
.
new
(
'Chameleon'
))
@sandbox
.
public_headers
.
expects
(
:add_search_path
).
with
(
Pathname
.
new
(
'Chameleon'
))
@pod
.
link_headers
end
end
...
...
spec/unit/sandbox_spec.rb
View file @
68f22d19
...
...
@@ -24,13 +24,17 @@ describe Pod::Sandbox do
end
it
"returns it's headers root"
do
@sandbox
.
build_headers
.
root
.
should
==
Pathname
.
new
(
File
.
join
(
TMP_POD_ROOT
,
"Headers"
))
@sandbox
.
build_headers
.
root
.
should
==
Pathname
.
new
(
File
.
join
(
TMP_POD_ROOT
,
"BuildHeaders"
))
end
it
"returns it's public headers root"
do
@sandbox
.
public_headers
.
root
.
should
==
Pathname
.
new
(
File
.
join
(
TMP_POD_ROOT
,
"Headers"
))
end
it
"can add namespaced headers to it's header path using symlinks and return the relative path"
do
FileUtils
.
mkdir_p
(
@sandbox
.
root
+
"ExampleLib/Headers"
)
FileUtils
.
mkdir_p
(
@sandbox
.
root
+
"ExampleLib/
Build
Headers"
)
namespace_path
=
Pathname
.
new
(
"ExampleLib"
)
relative_header_path
=
Pathname
.
new
(
"ExampleLib/Headers/MyHeader.h"
)
relative_header_path
=
Pathname
.
new
(
"ExampleLib/
Build
Headers/MyHeader.h"
)
File
.
open
(
@sandbox
.
root
+
relative_header_path
,
"w"
)
{
|
file
|
file
.
write
(
'hello'
)
}
symlink_path
=
@sandbox
.
build_headers
.
add_file
(
namespace_path
,
relative_header_path
)
symlink_path
.
should
.
be
.
symlink
...
...
@@ -38,11 +42,11 @@ describe Pod::Sandbox do
end
it
'can add multiple headers at once and return the relative symlink paths'
do
FileUtils
.
mkdir_p
(
@sandbox
.
root
+
"ExampleLib/Headers"
)
FileUtils
.
mkdir_p
(
@sandbox
.
root
+
"ExampleLib/
Build
Headers"
)
namespace_path
=
Pathname
.
new
(
"ExampleLib"
)
relative_header_paths
=
[
Pathname
.
new
(
"ExampleLib/Headers/MyHeader.h"
),
Pathname
.
new
(
"ExampleLib/Headers/MyOtherHeader.h"
)
Pathname
.
new
(
"ExampleLib/
Build
Headers/MyHeader.h"
),
Pathname
.
new
(
"ExampleLib/
Build
Headers/MyOtherHeader.h"
)
]
relative_header_paths
.
each
do
|
path
|
File
.
open
(
@sandbox
.
root
+
path
,
"w"
)
{
|
file
|
file
.
write
(
'hello'
)
}
...
...
@@ -55,21 +59,21 @@ describe Pod::Sandbox do
end
it
'keeps a list of unique header search paths when headers are added'
do
FileUtils
.
mkdir_p
(
@sandbox
.
root
+
"ExampleLib/Headers"
)
FileUtils
.
mkdir_p
(
@sandbox
.
root
+
"ExampleLib/
Build
Headers"
)
namespace_path
=
Pathname
.
new
(
"ExampleLib"
)
relative_header_paths
=
[
Pathname
.
new
(
"ExampleLib/Headers/MyHeader.h"
),
Pathname
.
new
(
"ExampleLib/Headers/MyOtherHeader.h"
)
Pathname
.
new
(
"ExampleLib/
Build
Headers/MyHeader.h"
),
Pathname
.
new
(
"ExampleLib/
Build
Headers/MyOtherHeader.h"
)
]
relative_header_paths
.
each
do
|
path
|
File
.
open
(
@sandbox
.
root
+
path
,
"w"
)
{
|
file
|
file
.
write
(
'hello'
)
}
end
@sandbox
.
build_headers
.
add_files
(
namespace_path
,
relative_header_paths
)
@sandbox
.
header_search_paths
.
should
.
include
(
"${PODS_ROOT}/
Headers/ExampleLib"
)
@sandbox
.
build_headers
.
search_paths
.
should
.
include
(
"${PODS_ROOT}/Build
Headers/ExampleLib"
)
end
it
'always adds the Headers root to the header search paths'
do
@sandbox
.
header_search_paths
.
should
.
include
(
"${PODS_ROOT}/
Headers"
)
@sandbox
.
build_headers
.
search_paths
.
should
.
include
(
"${PODS_ROOT}/Build
Headers"
)
end
it
'clears out its headers root when preparing for install'
do
...
...
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