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
c7c2440f
Commit
c7c2440f
authored
Jun 26, 2015
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Resolver] Test platform resolution
parent
cd57041f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
11 deletions
+16
-11
resolver.rb
lib/cocoapods/resolver.rb
+4
-4
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+0
-6
resolver_spec.rb
spec/unit/resolver_spec.rb
+12
-1
No files found.
lib/cocoapods/resolver.rb
View file @
c7c2440f
...
@@ -55,7 +55,7 @@ module Pod
...
@@ -55,7 +55,7 @@ module Pod
def
resolve
def
resolve
dependencies
=
podfile
.
target_definition_list
.
flat_map
do
|
target
|
dependencies
=
podfile
.
target_definition_list
.
flat_map
do
|
target
|
target
.
dependencies
.
each
do
|
dep
|
target
.
dependencies
.
each
do
|
dep
|
@platforms_by_dependency
[
dep
]
<<
target
.
platform
@platforms_by_dependency
[
dep
]
.
<
<
(
target
.
platform
).
uniq!
end
end
end
end
@cached_sets
=
{}
@cached_sets
=
{}
...
@@ -416,9 +416,9 @@ module Pod
...
@@ -416,9 +416,9 @@ module Pod
pred
+
pred
.
map
(
&
all_predecessors
).
reduce
(
Set
.
new
,
&
:&
)
<<
vertex
pred
+
pred
.
map
(
&
all_predecessors
).
reduce
(
Set
.
new
,
&
:&
)
<<
vertex
end
end
vertex
=
dependency_graph
.
vertex_named
(
dependency
.
name
)
vertex
=
dependency_graph
.
vertex_named
(
dependency
.
name
)
predecessors
=
all_predecessors
[
vertex
]
predecessors
=
all_predecessors
[
vertex
]
.
reject
{
|
v
|
v
.
explicit_requirements
.
empty?
}
platforms_to_satisfy
=
predecessors
.
map
(
&
:
requirements
).
flat_map
{
|
r
|
@platforms_by_dependency
[
r
]
}
platforms_to_satisfy
=
predecessors
.
flat_map
(
&
:explicit_
requirements
).
flat_map
{
|
r
|
@platforms_by_dependency
[
r
]
}
platforms_to_satisfy
.
all?
{
|
pts
|
spec
.
available_platforms
.
any
?
{
|
p
|
pts
.
supports?
(
p
)
}
}
platforms_to_satisfy
.
all?
{
|
pts
|
spec
.
available_platforms
.
select
{
|
p
|
p
.
name
==
pts
.
name
}.
all
?
{
|
p
|
pts
.
supports?
(
p
)
}
}
end
end
# Returns the target-appropriate nodes that are `successors` of `node`,
# Returns the target-appropriate nodes that are `successors` of `node`,
...
...
spec/unit/installer/analyzer_spec.rb
View file @
c7c2440f
...
@@ -328,12 +328,6 @@ module Pod
...
@@ -328,12 +328,6 @@ module Pod
]
]
end
end
it
'warns once any of the dependencies does not match the platform of its podfile target'
do
Specification
.
any_instance
.
stubs
(
:available_platforms
).
returns
([
Platform
.
new
(
:ios
,
'999'
)])
@analyzer
.
analyze
UI
.
warnings
.
should
.
match
(
/platform .* may not be compatible/
)
end
xit
'removes the specifications of the changed pods to prevent confusion in the resolution process'
do
xit
'removes the specifications of the changed pods to prevent confusion in the resolution process'
do
@analyzer
.
allow_pre_downloads
=
true
@analyzer
.
allow_pre_downloads
=
true
podspec
=
@analyzer
.
sandbox
.
root
+
'Local Podspecs/JSONKit.podspec'
podspec
=
@analyzer
.
sandbox
.
root
+
'Local Podspecs/JSONKit.podspec'
...
...
spec/unit/resolver_spec.rb
View file @
c7c2440f
...
@@ -180,6 +180,17 @@ module Pod
...
@@ -180,6 +180,17 @@ module Pod
end
.
message
.
should
.
match
/platform .* not compatible/
end
.
message
.
should
.
match
/platform .* not compatible/
end
end
it
'selects only platform-compatible versions'
do
@podfile
=
Podfile
.
new
do
platform
:osx
,
'10.7'
pod
'AFNetworking'
# the most recent version requires 10.8
end
@resolver
.
stubs
(
:podfile
).
returns
(
@podfile
)
@resolver
.
resolve
.
values
.
flatten
.
map
(
&
:to_s
).
sort
.
should
==
[
'AFNetworking (1.3.4)'
]
end
it
'raises if unable to find a specification'
do
it
'raises if unable to find a specification'
do
Specification
.
any_instance
.
stubs
(
:all_dependencies
).
returns
([
Dependency
.
new
(
'Windows'
)])
Specification
.
any_instance
.
stubs
(
:all_dependencies
).
returns
([
Dependency
.
new
(
'Windows'
)])
message
=
should
.
raise
Informative
do
message
=
should
.
raise
Informative
do
...
@@ -340,7 +351,7 @@ module Pod
...
@@ -340,7 +351,7 @@ module Pod
it
'raises if it finds two conflicting dependencies'
do
it
'raises if it finds two conflicting dependencies'
do
podfile
=
Podfile
.
new
do
podfile
=
Podfile
.
new
do
platform
:ios
platform
:ios
,
'8.0'
pod
'RestKit'
,
'0.23.3'
# dependends on AFNetworking ~> 1.3.0
pod
'RestKit'
,
'0.23.3'
# dependends on AFNetworking ~> 1.3.0
pod
'AFNetworking'
,
'> 2'
pod
'AFNetworking'
,
'> 2'
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