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
f6346828
Commit
f6346828
authored
Nov 08, 2016
by
Dimitris Koutsogiorgas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise an exception if unable to find a reference for a path and handle symlink references
parent
9033df9d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
2 deletions
+70
-2
CHANGELOG.md
CHANGELOG.md
+4
-0
pod_target_installer.rb
...ller/xcode/pods_project_generator/pod_target_installer.rb
+10
-2
project.rb
lib/cocoapods/project.rb
+1
-0
pod_target_installer_spec.rb
...xcode/pods_project_generator/pod_target_installer_spec.rb
+55
-0
No files found.
CHANGELOG.md
View file @
f6346828
...
@@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
##### Bug Fixes
*
Raise an exception if unable to find a reference for a path and handle symlink references.
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#5427
](
https://github.com/CocoaPods/CocoaPods/issues/5427
)
*
Re-escaped backslashes in embed_frameworks generator
*
Re-escaped backslashes in embed_frameworks generator
[
Harlan Haskins
](
https://github.com/harlanhaskins
)
[
Harlan Haskins
](
https://github.com/harlanhaskins
)
[
#6121
](
https://github.com/CocoaPods/CocoaPods/issues/6121
)
[
#6121
](
https://github.com/CocoaPods/CocoaPods/issues/6121
)
...
...
lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb
View file @
f6346828
...
@@ -97,11 +97,11 @@ module Pod
...
@@ -97,11 +97,11 @@ module Pod
}.
each
do
|
arc
,
files
|
}.
each
do
|
arc
,
files
|
files
=
files
-
headers
-
other_source_files
files
=
files
-
headers
-
other_source_files
flags
=
compiler_flags_for_consumer
(
consumer
,
arc
)
flags
=
compiler_flags_for_consumer
(
consumer
,
arc
)
regular_file_refs
=
files
.
map
{
|
sf
|
project
.
reference_for_path
(
sf
)
}
regular_file_refs
=
project_file_references_array
(
files
,
'source'
)
native_target
.
add_file_references
(
regular_file_refs
,
flags
)
native_target
.
add_file_references
(
regular_file_refs
,
flags
)
end
end
header_file_refs
=
headers
.
map
{
|
sf
|
project
.
reference_for_path
(
sf
)
}
header_file_refs
=
project_file_references_array
(
headers
,
'header'
)
native_target
.
add_file_references
(
header_file_refs
)
do
|
build_file
|
native_target
.
add_file_references
(
header_file_refs
)
do
|
build_file
|
add_header
(
build_file
,
public_headers
,
private_headers
)
add_header
(
build_file
,
public_headers
,
private_headers
)
end
end
...
@@ -360,6 +360,14 @@ module Pod
...
@@ -360,6 +360,14 @@ module Pod
@custom_module_map
||=
target
.
file_accessors
.
first
.
module_map
@custom_module_map
||=
target
.
file_accessors
.
first
.
module_map
end
end
def
project_file_references_array
(
files
,
file_type
)
files
.
map
do
|
sf
|
project
.
reference_for_path
(
sf
).
tap
do
|
ref
|
raise
Informative
,
"Unable to find
#{
file_type
}
ref for
#{
sf
}
for target
#{
target
.
name
}
."
unless
ref
end
end
end
def
header_mappings_dir
def
header_mappings_dir
return
@header_mappings_dir
if
defined?
(
@header_mappings_dir
)
return
@header_mappings_dir
if
defined?
(
@header_mappings_dir
)
file_accessor
=
target
.
file_accessors
.
first
file_accessor
=
target
.
file_accessors
.
first
...
...
lib/cocoapods/project.rb
View file @
f6346828
...
@@ -184,6 +184,7 @@ module Pod
...
@@ -184,6 +184,7 @@ module Pod
group
=
group_for_path_in_group
(
file_path_name
,
group
,
reflect_file_system_structure
)
group
=
group_for_path_in_group
(
file_path_name
,
group
,
reflect_file_system_structure
)
if
ref
=
reference_for_path
(
file_path_name
.
realpath
)
if
ref
=
reference_for_path
(
file_path_name
.
realpath
)
@refs_by_absolute_path
[
absolute_path
.
to_s
]
=
ref
ref
ref
else
else
ref
=
group
.
new_file
(
file_path_name
.
realpath
)
ref
=
group
.
new_file
(
file_path_name
.
realpath
)
...
...
spec/unit/installer/xcode/pods_project_generator/pod_target_installer_spec.rb
View file @
f6346828
...
@@ -147,6 +147,61 @@ module Pod
...
@@ -147,6 +147,61 @@ module Pod
names
.
should
.
include
(
'Banana.m'
)
names
.
should
.
include
(
'Banana.m'
)
end
end
describe
'deals with invalid source file references'
do
before
do
file_accessor
=
@pod_target
.
file_accessors
.
first
@first_header_file
=
file_accessor
.
source_files
.
find
{
|
sf
|
sf
.
extname
==
'.h'
}
@first_source_file
=
file_accessor
.
source_files
.
find
{
|
sf
|
sf
.
extname
==
'.m'
}
@header_symlink_file
=
@first_header_file
.
dirname
+
"SymLinkOf-
#{
@first_header_file
.
basename
}
"
@source_symlink_file
=
@first_source_file
.
dirname
+
"SymLinkOf-
#{
@first_source_file
.
basename
}
"
FileUtils
.
rm_f
(
@header_symlink_file
.
to_s
)
FileUtils
.
rm_f
(
@source_symlink_file
.
to_s
)
end
after
do
FileUtils
.
rm_f
(
@header_symlink_file
.
to_s
)
FileUtils
.
rm_f
(
@source_symlink_file
.
to_s
)
end
it
'raises when source file reference is not found'
do
File
.
symlink
(
@first_source_file
,
@source_symlink_file
)
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@pod_target
.
file_accessors
=
[
file_accessor
]
exception
=
lambda
{
@installer
.
install!
}.
should
.
raise
Informative
exception
.
message
.
should
.
include
"Unable to find source ref for
#{
@source_symlink_file
}
for target BananaLib."
end
it
'raises when header file reference is not found'
do
File
.
symlink
(
@first_header_file
,
@header_symlink_file
)
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@pod_target
.
file_accessors
=
[
file_accessor
]
exception
=
lambda
{
@installer
.
install!
}.
should
.
raise
Informative
exception
.
message
.
should
.
include
"Unable to find header ref for
#{
@header_symlink_file
}
for target BananaLib."
end
it
'does not raise when header file reference is found'
do
File
.
symlink
(
@first_header_file
,
@header_symlink_file
)
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@pod_target
.
file_accessors
=
[
file_accessor
]
group
=
@project
.
group_for_spec
(
'BananaLib'
)
@project
.
add_file_reference
(
@header_symlink_file
.
to_s
,
group
)
lambda
{
@installer
.
install!
}.
should
.
not
.
raise
end
it
'does not raise when source file reference is found'
do
File
.
symlink
(
@first_source_file
,
@source_symlink_file
)
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@pod_target
.
file_accessors
=
[
file_accessor
]
group
=
@project
.
group_for_spec
(
'BananaLib'
)
@project
.
add_file_reference
(
@source_symlink_file
.
to_s
,
group
)
lambda
{
@installer
.
install!
}.
should
.
not
.
raise
end
end
#--------------------------------------#
#--------------------------------------#
it
'adds framework resources to the framework target'
do
it
'adds framework resources to the framework target'
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