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
a951feef
Commit
a951feef
authored
Feb 14, 2017
by
Danielle Tomlinson
Committed by
GitHub
Feb 14, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6434 from hailstorm350/kenw/cache-macho-dynamic-query-results
Cache results of dynamic_binary?
parents
8b02913f
3604c644
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
3 deletions
+25
-3
CHANGELOG.md
CHANGELOG.md
+4
-0
file_accessor.rb
lib/cocoapods/sandbox/file_accessor.rb
+6
-3
file_accessor_spec.rb
spec/unit/sandbox/file_accessor_spec.rb
+15
-0
No files found.
CHANGELOG.md
View file @
a951feef
...
@@ -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`
[
Orta Therox
](
https://github.com/orta
)
[
Orta Therox
](
https://github.com/orta
)
[
xcodeproj#463
](
https://github.com/CocoaPods/Xcodeproj/pull/463
)
[
xcodeproj#463
](
https://github.com/CocoaPods/Xcodeproj/pull/463
)
*
Cache results of dynamic_binary?
[
Ken Wigginton
](
https://github.com/hailstorm350
)
[
#6434
](
https://github.com/CocoaPods/CocoaPods/pull/6434
)
##### Bug Fixes
##### Bug Fixes
*
Correctly handle
`OTHER_LDFLAGS`
for targets with inherit search paths and source pods.
*
Correctly handle
`OTHER_LDFLAGS`
for targets with inherit search paths and source pods.
...
...
lib/cocoapods/sandbox/file_accessor.rb
View file @
a951feef
...
@@ -372,10 +372,13 @@ module Pod
...
@@ -372,10 +372,13 @@ module Pod
# @return [Boolean] Whether `binary` can be dynamically linked.
# @return [Boolean] Whether `binary` can be dynamically linked.
#
#
def
dynamic_binary?
(
binary
)
def
dynamic_binary?
(
binary
)
return
unless
binary
.
file?
@cached_dynamic_binary_results
||=
{}
MachO
.
open
(
binary
).
dylib?
return
@cached_dynamic_binary_results
[
binary
]
unless
@cached_dynamic_binary_results
[
binary
].
nil?
return
false
unless
binary
.
file?
@cached_dynamic_binary_results
[
binary
]
=
MachO
.
open
(
binary
).
dylib?
rescue
MachO
::
MachOError
rescue
MachO
::
MachOError
false
@cached_dynamic_binary_results
[
binary
]
=
false
end
end
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------#
...
...
spec/unit/sandbox/file_accessor_spec.rb
View file @
a951feef
...
@@ -265,6 +265,21 @@ module Pod
...
@@ -265,6 +265,21 @@ module Pod
@accessor
.
send
(
:paths_for_attribute
,
:source_files
)
@accessor
.
send
(
:paths_for_attribute
,
:source_files
)
end
end
end
end
describe
'#dynamic_binary?'
do
it
'not a dynamic binary if its not a file'
do
binary
=
stub
(
:file?
=>
false
)
@accessor
.
send
(
:dynamic_binary?
,
binary
).
should
.
be
.
false
end
it
'uses the cache after the first time'
do
binary
=
stub
(
:file?
=>
true
)
macho_file
=
stub
(
:dylib?
=>
true
)
MachO
.
stubs
(
:open
).
once
.
returns
(
macho_file
)
@accessor
.
send
(
:dynamic_binary?
,
binary
).
should
.
be
.
true
@accessor
.
send
(
:dynamic_binary?
,
binary
).
should
.
be
.
true
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