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
6666abed
Unverified
Commit
6666abed
authored
Mar 10, 2018
by
Samuel Giddins
Committed by
GitHub
Mar 10, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7470 from rmtmckenzie/symlink-headers-fix
Actually return absolute paths from glob
parents
212a5d3c
17549920
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
138 additions
and
7 deletions
+138
-7
CHANGELOG.md
CHANGELOG.md
+4
-0
path_list.rb
lib/cocoapods/sandbox/path_list.rb
+1
-1
pod_target_installer_spec.rb
...xcode/pods_project_generator/pod_target_installer_spec.rb
+62
-6
path_list_spec.rb
spec/unit/sandbox/path_list_spec.rb
+71
-0
No files found.
CHANGELOG.md
View file @
6666abed
...
@@ -105,6 +105,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -105,6 +105,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Ruenzuo
](
https://github.com/Ruenzuo
)
[
Ruenzuo
](
https://github.com/Ruenzuo
)
[
#6964
](
https://github.com/CocoaPods/CocoaPods/issues/6964
)
[
#6964
](
https://github.com/CocoaPods/CocoaPods/issues/6964
)
*
Fix returning absolute paths from glob, fixes issue with static framework and public headers.
[
Morgan McKenzie
](
https://github.com/rmtmckenzie
)
[
#7463
](
https://github.com/CocoaPods/CocoaPods/issues/7463
)
## 1.4.0 (2018-01-18)
## 1.4.0 (2018-01-18)
##### Enhancements
##### Enhancements
...
...
lib/cocoapods/sandbox/path_list.rb
View file @
6666abed
...
@@ -88,7 +88,7 @@ module Pod
...
@@ -88,7 +88,7 @@ module Pod
# @return [Array<Pathname>]
# @return [Array<Pathname>]
#
#
def
glob
(
patterns
,
options
=
{})
def
glob
(
patterns
,
options
=
{})
relative_glob
(
patterns
,
options
).
map
{
|
p
|
root
+
p
}
relative_glob
(
patterns
,
options
).
map
{
|
p
|
(
root
+
p
).
realpath
}
end
end
# The list of relative paths that are case insensitively matched by a
# The list of relative paths that are case insensitively matched by a
...
...
spec/unit/installer/xcode/pods_project_generator/pod_target_installer_spec.rb
View file @
6666abed
...
@@ -412,21 +412,25 @@ module Pod
...
@@ -412,21 +412,25 @@ module Pod
end
end
it
'raises when source file reference is not found'
do
it
'raises when source file reference is not found'
do
File
.
symlink
(
@first_source_file
,
@source_symlink_file
)
file_path
=
@first_source_file
.
dirname
+
"notthere-
#{
@first_source_file
.
basename
}
"
File
.
symlink
(
file_path
,
@source_symlink_file
)
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@pod_target
.
file_accessors
=
[
file_accessor
]
@pod_target
.
file_accessors
=
[
file_accessor
]
exception
=
lambda
{
@installer
.
install!
}.
should
.
raise
Informative
exception
=
lambda
{
@installer
.
install!
}.
should
.
raise
Errno
::
ENOENT
exception
.
message
.
should
.
include
"Unable to find source ref for
#{
@source_symlink_file
}
for target BananaLib."
exception
.
message
.
should
.
include
'No such file or directory'
exception
.
message
.
should
.
include
file_path
.
to_s
end
end
it
'raises when header file reference is not found'
do
it
'raises when header file reference is not found'
do
File
.
symlink
(
@first_header_file
,
@header_symlink_file
)
file_path
=
@first_header_file
.
dirname
+
"notthere-
#{
@first_header_file
.
basename
}
"
File
.
symlink
(
file_path
,
@header_symlink_file
)
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@pod_target
.
file_accessors
=
[
file_accessor
]
@pod_target
.
file_accessors
=
[
file_accessor
]
exception
=
lambda
{
@installer
.
install!
}.
should
.
raise
Informative
exception
=
lambda
{
@installer
.
install!
}.
should
.
raise
Errno
::
ENOENT
exception
.
message
.
should
.
include
"Unable to find header ref for
#{
@header_symlink_file
}
for target BananaLib."
exception
.
message
.
should
.
include
'No such file or directory'
exception
.
message
.
should
.
include
file_path
.
to_s
end
end
it
'does not raise when header file reference is found'
do
it
'does not raise when header file reference is found'
do
...
@@ -452,6 +456,58 @@ module Pod
...
@@ -452,6 +456,58 @@ module Pod
#--------------------------------------#
#--------------------------------------#
describe
'in symlinked directory'
do
before
do
# copy banana-lib to a temp directory, make symlink to this dir
@tmpdir
=
Pathname
.
new
(
Dir
.
mktmpdir
)
old_path_root
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
)).
root
FileUtils
.
copy_entry
(
old_path_root
.
to_s
,
@tmpdir
+
'banana-lib'
)
@symlink_dir
=
old_path_root
.
dirname
+
'banana-lib-symlinked'
FileUtils
.
remove_entry
(
@symlink_dir
)
if
File
.
symlink?
(
@symlink_dir
)
File
.
symlink
(
@tmpdir
+
'banana-lib'
,
@symlink_dir
.
to_s
)
# reset project to use symlinked dir
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
config
.
sandbox
.
project
=
@project
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib-symlinked/'
))
@spec
=
fixture_spec
(
'banana-lib-symlinked/BananaLib.podspec'
)
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@project
.
add_pod_group
(
'BananaLib'
,
fixture
(
'banana-lib-symlinked/'
))
group
=
@project
.
group_for_spec
(
'BananaLib'
)
file_accessor
.
source_files
.
each
do
|
file
|
@project
.
add_file_reference
(
file
,
group
)
end
file_accessor
.
resources
.
each
do
|
resource
|
@project
.
add_file_reference
(
resource
,
group
)
end
@pod_target
=
PodTarget
.
new
([
@spec
],
[
@target_definition
],
config
.
sandbox
)
@pod_target
.
file_accessors
=
[
file_accessor
]
@pod_target
.
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Release'
=>
:release
}
@installer
=
PodTargetInstaller
.
new
(
config
.
sandbox
,
@pod_target
)
end
after
do
FileUtils
.
remove_entry
(
@tmpdir
)
if
Dir
.
exist?
(
@tmpdir
)
FileUtils
.
remove_entry
(
@symlink_dir
)
if
File
.
symlink?
(
@symlink_dir
)
end
it
'headers are public if podspec directory is symlinked for static lib'
do
@pod_target
.
stubs
(
:static_framework?
).
returns
(
true
)
@pod_target
.
stubs
(
:requires_frameworks?
).
returns
(
true
)
@installer
.
install!
@project
.
targets
.
first
.
headers_build_phase
.
files
.
find
do
|
hf
|
hf
.
display_name
==
'Banana.h'
&&
hf
.
settings
[
'ATTRIBUTES'
]
==
[
'Public'
]
end
.
should
.
not
.
nil?
end
end
#--------------------------------------#
it
'adds framework resources to the framework target'
do
it
'adds framework resources to the framework target'
do
@pod_target
.
stubs
(
:requires_frameworks?
=>
true
)
@pod_target
.
stubs
(
:requires_frameworks?
=>
true
)
@installer
.
install!
@installer
.
install!
...
...
spec/unit/sandbox/path_list_spec.rb
View file @
6666abed
...
@@ -109,6 +109,29 @@ module Pod
...
@@ -109,6 +109,29 @@ module Pod
paths
.
all?
(
&
:absolute?
).
should
==
true
paths
.
all?
(
&
:absolute?
).
should
==
true
end
end
describe
'Symlinked Directory'
do
before
do
@tmpdir
=
Pathname
.
new
(
Dir
.
mktmpdir
)
FileUtils
.
copy_entry
(
@path_list
.
root
.
to_s
,
@tmpdir
+
'banana-lib'
)
@symlink_dir
=
@path_list
.
root
.
dirname
+
'banana-lib-symlinked'
FileUtils
.
remove_entry
(
@symlink_dir
)
if
File
.
symlink?
(
@symlink_dir
)
end
after
do
FileUtils
.
remove_entry
(
@tmpdir
)
if
Dir
.
exist?
(
@tmpdir
)
FileUtils
.
remove_entry
(
@symlink_dir
)
if
File
.
symlink?
(
@symlink_dir
)
end
it
'glob returns the absolute path when root is a symlinked directory'
do
File
.
symlink
(
@tmpdir
+
'banana-lib'
,
@symlink_dir
.
to_s
)
@path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib-symlinked/'
))
paths
=
@path_list
.
glob
(
'Classes/*.{h,m}'
)
paths
.
first
.
realpath
.
to_s
.
should
.
include?
@tmpdir
.
to_s
end
end
it
'can return the relative paths from glob'
do
it
'can return the relative paths from glob'
do
paths
=
@path_list
.
relative_glob
(
'Classes/*.{h,m}'
)
paths
=
@path_list
.
relative_glob
(
'Classes/*.{h,m}'
)
paths
.
any?
(
&
:absolute?
).
should
==
false
paths
.
any?
(
&
:absolute?
).
should
==
false
...
@@ -249,5 +272,53 @@ module Pod
...
@@ -249,5 +272,53 @@ module Pod
end
end
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
describe
'Symlinks'
do
before
do
@symlink_dir
=
@path_list
.
root
+
'Classes'
+
'symlinked'
@symlink_dir_file
=
@symlink_dir
+
'someheader.h'
@symlink_file
=
@path_list
.
root
+
'Classes'
+
'symlinked.h'
@tmpdir
=
Pathname
.
new
(
Dir
.
mktmpdir
)
tmpfile
=
Tempfile
.
new
([
'base'
,
'.h'
])
@tmpfile
=
tmpfile
.
path
tmpfile
.
close
@tmpdirheader
=
@tmpdir
+
'someheader.h'
File
.
write
(
@tmpdirheader
.
to_s
,
'// this file does nothing. \n'
)
File
.
write
(
@tmpfile
.
to_s
,
'// this file also does nothing. \n'
)
FileUtils
.
remove_entry
(
@symlink_dir
)
if
File
.
symlink?
(
@symlink_dir
)
FileUtils
.
remove_entry
(
@symlink_file
)
if
File
.
symlink?
(
@symlink_file
)
end
after
do
FileUtils
.
remove_entry
(
@tmpdir
)
if
Dir
.
exist?
(
@tmpdir
)
FileUtils
.
remove_entry
(
@tmpfile
)
if
File
.
exist?
(
@tmpfile
)
FileUtils
.
remove_entry
(
@symlink_dir
)
if
File
.
symlink?
(
@symlink_dir
)
FileUtils
.
remove_entry
(
@symlink_file
)
if
File
.
symlink?
(
@symlink_file
)
end
it
'includes symlinked file'
do
@path_list
.
instance_variable_set
(
:@files
,
nil
)
File
.
symlink
(
@tmpfile
,
@symlink_file
)
@path_list
.
files
.
map
(
&
:to_s
).
include?
(
'Classes/symlinked.h'
).
should
==
true
end
it
'includes symlinked dir'
do
@path_list
.
instance_variable_set
(
:@dirs
,
nil
)
File
.
symlink
(
@tmpdir
,
@symlink_dir
)
@path_list
.
dirs
.
map
(
&
:to_s
).
include?
(
'Classes/symlinked'
).
should
==
true
end
it
'doesn\'t include file in symlinked dir'
do
@path_list
.
instance_variable_set
(
:@files
,
nil
)
@path_list
.
instance_variable_set
(
:@dirs
,
nil
)
File
.
symlink
(
@tmpdir
,
@symlink_dir
)
@path_list
.
files
.
map
(
&
:to_s
).
include?
(
'Classes/symlinked/someheader.h'
).
should
==
false
end
end
#-------------------------------------------------------------------------#
end
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