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
e22bb4e7
Commit
e22bb4e7
authored
Apr 12, 2018
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix determining whether specs are test-only when there are multiple target definitions
parent
719a238c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
resolver.rb
lib/cocoapods/resolver.rb
+4
-1
resolver_spec.rb
spec/unit/resolver_spec.rb
+44
-0
No files found.
lib/cocoapods/resolver.rb
View file @
e22bb4e7
...
...
@@ -134,12 +134,15 @@ module Pod
def
resolver_specs_by_target
@resolver_specs_by_target
||=
{}.
tap
do
|
resolver_specs_by_target
|
@podfile_dependency_cache
.
target_definition_list
.
each
do
|
target
|
# can't use vertex.root? since that considers _all_ targets
explicit_dependencies
=
@podfile_dependency_cache
.
target_definition_dependencies
(
target
).
map
(
&
:name
).
to_set
vertices
=
valid_dependencies_for_target
(
target
)
resolver_specs_by_target
[
target
]
=
vertices
.
map
do
|
vertex
|
payload
=
vertex
.
payload
test_only
=
(
!
vertex
.
root?
||
payload
.
test_specification?
)
&&
vertex
.
recursive_predecessors
.
all?
{
|
v
|
!
v
.
root?
||
v
.
payload
.
test_specification?
}
test_only
=
(
!
explicit_dependencies
.
include?
(
vertex
.
name
)
||
payload
.
test_specification?
)
&&
(
vertex
.
recursive_predecessors
&
vertices
).
all?
{
|
v
|
!
explicit_dependencies
.
include?
(
v
.
name
)
||
v
.
payload
.
test_specification?
}
spec_source
=
payload
.
respond_to?
(
:spec_source
)
&&
payload
.
spec_source
ResolverSpecification
.
new
(
payload
,
test_only
,
spec_source
)
end
.
...
...
spec/unit/resolver_spec.rb
View file @
e22bb4e7
...
...
@@ -475,6 +475,50 @@ module Pod
resolved_specs
.
find
{
|
rs
|
rs
.
name
==
'MainSpec/Tests'
}.
should
.
be
.
used_by_tests_only
end
it
'handles test only dependencies when they are also used in a different target'
do
@podfile
=
Podfile
.
new
do
platform
:ios
,
'10'
target
'A'
do
pod
'MainSpec'
,
:git
=>
'GIT-URL'
,
:testspecs
=>
[
'Tests'
]
end
target
'B'
do
pod
'Expecta'
pod
'OCMock'
end
end
spec
=
Spec
.
new
do
|
s
|
s
.
name
=
'MainSpec'
s
.
version
=
'1.2.3'
s
.
platform
=
:ios
s
.
dependency
'Expecta'
s
.
test_spec
'Tests'
do
|
tss
|
tss
.
source_files
=
'some/file'
tss
.
dependency
'Expecta'
tss
.
dependency
'OCMock'
end
end
config
.
sandbox
.
expects
(
:specification
).
with
(
'MainSpec'
).
returns
(
spec
)
resolver
=
create_resolver
resolved_specs
=
resolver
.
resolve
a_specs
=
resolved_specs
[
@podfile
.
target_definitions
[
'A'
]]
b_specs
=
resolved_specs
[
@podfile
.
target_definitions
[
'B'
]]
a_specs
.
map
(
&
:name
).
sort
.
should
==
%w(Expecta MainSpec MainSpec/Tests OCMock)
b_specs
.
map
(
&
:name
).
sort
.
should
==
%w(Expecta OCMock)
a_specs
.
find
{
|
rs
|
rs
.
name
==
'Expecta'
}.
should
.
not
.
be
.
used_by_tests_only
a_specs
.
find
{
|
rs
|
rs
.
name
==
'MainSpec'
}.
should
.
not
.
be
.
used_by_tests_only
a_specs
.
find
{
|
rs
|
rs
.
name
==
'MainSpec/Tests'
}.
should
.
be
.
used_by_tests_only
a_specs
.
find
{
|
rs
|
rs
.
name
==
'OCMock'
}.
should
.
be
.
used_by_tests_only
b_specs
.
find
{
|
rs
|
rs
.
name
==
'Expecta'
}.
should
.
not
.
be
.
used_by_tests_only
b_specs
.
find
{
|
rs
|
rs
.
name
==
'OCMock'
}.
should
.
not
.
be
.
used_by_tests_only
end
it
'allows pre-release spec versions when a requirement has an '
\
'external source'
do
@podfile
=
Podfile
.
new
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