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
687c2c78
Commit
687c2c78
authored
Aug 01, 2017
by
Dimitris Koutsogiorgas
Committed by
GitHub
Aug 01, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6915 from dnkoutso/subspecs_with_tests
Properly install pod targets with test specs within subspecs
parents
dfbef046
3aa8b5e1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
10 deletions
+94
-10
CHANGELOG.md
CHANGELOG.md
+4
-0
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+24
-9
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+66
-1
No files found.
CHANGELOG.md
View file @
687c2c78
...
@@ -16,6 +16,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -16,6 +16,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#6917
](
https://github.com/CocoaPods/CocoaPods/pull/6917
)
[
#6917
](
https://github.com/CocoaPods/CocoaPods/pull/6917
)
*
Properly install pod targets with test specs within subspecs
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#6915
](
https://github.com/CocoaPods/CocoaPods/pull/6915
)
*
Add
`--skip-tests`
support
`push`
to push command
*
Add
`--skip-tests`
support
`push`
to push command
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#6893
](
https://github.com/CocoaPods/CocoaPods/pull/6893
)
[
#6893
](
https://github.com/CocoaPods/CocoaPods/pull/6893
)
...
...
lib/cocoapods/installer/analyzer.rb
View file @
687c2c78
...
@@ -429,17 +429,28 @@ module Pod
...
@@ -429,17 +429,28 @@ module Pod
end
end
end
end
target
.
pod_targets
=
pod_targets
.
select
do
|
pod_target
|
target
.
pod_targets
=
filter_pod_targets_for_target_definition
(
pod_targets
,
target_definition
)
target_definition_included
=
pod_target
.
target_definitions
.
include?
(
target_definition
)
explicitly_defined_in_target_definition
=
target_definition
.
non_inherited_dependencies
.
map
(
&
:name
).
include?
(
pod_target
.
name
)
next
false
unless
target_definition_included
next
true
if
explicitly_defined_in_target_definition
!
pod_target_test_only?
(
pod_target
,
pod_targets
)
end
target
target
end
end
# Returns a filtered list of pod targets that should or should not be part of the target definition. Pod targets
# used by tests only are filtered.
#
# @param [Array<PodTarget>] pod_targets
# the array of pod targets to check against
#
# @param [TargetDefinition] target_definition
# the target definition to use as the base for filtering
#
# @return [Array<PodTarget>] the filtered list of pod targets.
#
def
filter_pod_targets_for_target_definition
(
pod_targets
,
target_definition
)
pod_targets
.
select
do
|
pod_target
|
pod_target
.
target_definitions
.
include?
(
target_definition
)
&&
!
pod_target_test_only?
(
pod_target
,
pod_targets
)
end
end
# Returns true if a pod target is only used by other pod targets as a test dependency and therefore should
# Returns true if a pod target is only used by other pod targets as a test dependency and therefore should
# not be included as part of the aggregate target.
# not be included as part of the aggregate target.
#
#
...
@@ -457,8 +468,12 @@ module Pod
...
@@ -457,8 +468,12 @@ module Pod
if
@test_pod_target_analyzer_cache
.
key?
(
key
)
if
@test_pod_target_analyzer_cache
.
key?
(
key
)
return
@test_pod_target_analyzer_cache
[
key
]
return
@test_pod_target_analyzer_cache
[
key
]
end
end
source
=
pod_targets
.
any?
{
|
pt
|
pt
.
dependent_targets
.
map
(
&
:name
).
include?
(
name
)
}
source
=
pod_targets
.
any?
do
|
pt
|
test
=
pod_targets
.
any?
{
|
pt
|
pt
.
test_dependent_targets
.
map
(
&
:name
).
include?
(
name
)
}
pt
.
dependent_targets
.
map
(
&
:name
).
include?
(
name
)
end
test
=
pod_targets
.
any?
do
|
pt
|
pt
.
test_dependent_targets
.
reject
{
|
dpt
|
dpt
.
name
==
pt
.
name
}.
map
(
&
:name
).
include?
(
name
)
end
@test_pod_target_analyzer_cache
[
key
]
=
!
source
&&
test
@test_pod_target_analyzer_cache
[
key
]
=
!
source
&&
test
end
end
...
...
spec/unit/installer/analyzer_spec.rb
View file @
687c2c78
...
@@ -685,7 +685,72 @@ module Pod
...
@@ -685,7 +685,72 @@ module Pod
@analyzer
.
send
(
:pod_target_test_only?
,
pod_target_four
,
all_pod_targets
).
should
.
be
.
false
@analyzer
.
send
(
:pod_target_test_only?
,
pod_target_four
,
all_pod_targets
).
should
.
be
.
false
end
end
#-------------------------------------------------------------------------#
it
'handles test only pod targets that depend on themselves as tests'
do
pod_target_one
=
stub
(
:name
=>
'Pod1'
,
:dependent_targets
=>
[])
pod_target_one
.
stubs
(
:test_dependent_targets
=>
[
pod_target_one
])
all_pod_targets
=
[
pod_target_one
]
@analyzer
.
send
(
:pod_target_test_only?
,
pod_target_one
,
all_pod_targets
).
should
.
be
.
false
end
it
'handles test only pod targets that depend on themselves as tests but are also dependent as sources'
do
pod_target_one
=
stub
(
:name
=>
'Pod1'
,
:dependent_targets
=>
[])
pod_target_one
.
stubs
(
:test_dependent_targets
=>
[
pod_target_one
])
pod_target_two
=
stub
(
:name
=>
'Pod2'
,
:dependent_targets
=>
[
pod_target_one
],
:test_dependent_targets
=>
[])
all_pod_targets
=
[
pod_target_one
,
pod_target_two
]
@analyzer
.
send
(
:pod_target_test_only?
,
pod_target_one
,
all_pod_targets
).
should
.
be
.
false
end
it
'includes pod target when declared in the target definition and is not test only'
do
target_definition
=
stub
pod_target
=
stub
(
:name
=>
'Pod1'
,
:dependent_targets
=>
[],
:test_dependent_targets
=>
[],
:target_definitions
=>
[
target_definition
])
all_pod_targets
=
[
pod_target
]
@analyzer
.
stubs
(
:pod_target_test_only?
).
with
(
pod_target
,
all_pod_targets
).
returns
(
false
)
@analyzer
.
send
(
:filter_pod_targets_for_target_definition
,
all_pod_targets
,
target_definition
).
should
==
[
pod_target
]
end
it
'includes pod target when declared in the pod target definition but has a test dependency on itself'
do
target_definition
=
stub
pod_target
=
stub
(
:name
=>
'Pod1'
,
:dependent_targets
=>
[],
:target_definitions
=>
[
target_definition
])
pod_target
.
stubs
(
:test_dependent_targets
=>
[
pod_target
])
all_pod_targets
=
[
pod_target
]
@analyzer
.
send
(
:filter_pod_targets_for_target_definition
,
all_pod_targets
,
target_definition
).
should
==
[
pod_target
]
end
it
'does not include pod target if declared within pod target definition and is a test only target'
do
target_definition
=
stub
pod_target
=
stub
(
:name
=>
'Pod1'
,
:dependent_targets
=>
[],
:test_dependent_targets
=>
[],
:target_definitions
=>
[
target_definition
])
all_pod_targets
=
[
pod_target
]
@analyzer
.
stubs
(
:pod_target_test_only?
).
with
(
pod_target
,
all_pod_targets
).
returns
(
true
)
@analyzer
.
send
(
:filter_pod_targets_for_target_definition
,
all_pod_targets
,
target_definition
).
should
.
be
.
empty
end
it
'does not include pod target if not within target definition'
do
target_definition
=
stub
pod_target
=
stub
(
:name
=>
'Pod1'
,
:dependent_targets
=>
[],
:test_dependent_targets
=>
[],
:target_definitions
=>
[])
all_pod_targets
=
[
pod_target
]
@analyzer
.
send
(
:filter_pod_targets_for_target_definition
,
all_pod_targets
,
target_definition
).
should
.
be
.
empty
end
it
'handles complicated scenario of pod target dependencies'
do
target_definition_one
=
stub
target_definition_two
=
stub
pod_target_one
=
stub
(
:name
=>
'Pod1'
,
:dependent_targets
=>
[],
:test_dependent_targets
=>
[],
:target_definitions
=>
[
target_definition_one
,
target_definition_two
])
pod_target_two
=
stub
(
:name
=>
'Pod2'
,
:dependent_targets
=>
[],
:test_dependent_targets
=>
[],
:target_definitions
=>
[
target_definition_one
])
pod_target_three
=
stub
(
:name
=>
'Pod3'
,
:dependent_targets
=>
[],
:target_definitions
=>
[
target_definition_two
])
pod_target_three
.
stubs
(
:test_dependent_targets
=>
[
pod_target_three
])
pod_target_four
=
stub
(
:name
=>
'Pod4'
,
:dependent_targets
=>
[
pod_target_one
],
:test_dependent_targets
=>
[],
:target_definitions
=>
[
target_definition_one
])
pod_target_five
=
stub
(
:name
=>
'Pod5'
,
:dependent_targets
=>
[
pod_target_one
],
:test_dependent_targets
=>
[
pod_target_three
],
:target_definitions
=>
[
target_definition_two
])
all_pod_targets
=
[
pod_target_one
,
pod_target_two
,
pod_target_three
,
pod_target_four
,
pod_target_five
]
@analyzer
.
send
(
:filter_pod_targets_for_target_definition
,
all_pod_targets
,
target_definition_one
).
should
==
[
pod_target_one
,
pod_target_two
,
pod_target_four
,
]
@analyzer
.
send
(
:filter_pod_targets_for_target_definition
,
all_pod_targets
,
target_definition_two
).
should
==
[
pod_target_one
,
pod_target_five
,
]
end
describe
'extension targets'
do
describe
'extension targets'
do
before
do
before
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