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
4730679b
Commit
4730679b
authored
Jan 31, 2018
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Partition test/non-test specs in the PodTarget
parent
dc934649
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
17 deletions
+16
-17
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+6
-4
pod_target_integrator.rb
...ler/xcode/pods_project_generator/pod_target_integrator.rb
+1
-1
pod_target.rb
lib/cocoapods/target/pod_target.rb
+5
-8
file_references_installer_spec.rb
.../pods_project_generator/file_references_installer_spec.rb
+3
-3
installer_spec.rb
spec/unit/installer_spec.rb
+1
-1
No files found.
lib/cocoapods/installer/analyzer.rb
View file @
4730679b
...
...
@@ -512,8 +512,9 @@ module Pod
hash
[
name
]
=
values
.
sort_by
{
|
pt
|
pt
.
specs
.
count
}
end
pod_targets
.
each
do
|
target
|
dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
reject
(
&
:test_specification?
).
to_set
,
target
.
platform
,
all_resolver_specs
.
to_set
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
select
(
&
:test_specification?
).
to_set
,
target
.
platform
,
all_resolver_specs
.
to_set
).
group_by
(
&
:root
)
all_specs
=
all_resolver_specs
.
to_set
dependencies
=
transitive_dependencies_for_specs
(
target
.
non_test_specs
.
to_set
,
target
.
platform
,
all_specs
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
test_specs
.
to_set
,
target
.
platform
,
all_specs
).
group_by
(
&
:root
)
test_dependencies
.
delete_if
{
|
k
|
dependencies
.
key?
k
}
target
.
dependent_targets
=
filter_dependencies
(
dependencies
,
pod_targets_by_name
,
target
)
target
.
test_dependent_targets
=
filter_dependencies
(
test_dependencies
,
pod_targets_by_name
,
target
)
...
...
@@ -527,8 +528,9 @@ module Pod
end
pod_targets
.
each
do
|
target
|
dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
reject
(
&
:test_specification?
).
to_set
,
target
.
platform
,
specs
.
map
(
&
:spec
).
to_set
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
select
(
&
:test_specification?
).
to_set
,
target
.
platform
,
specs
.
map
(
&
:spec
).
to_set
).
group_by
(
&
:root
)
all_specs
=
specs
.
map
(
&
:spec
).
to_set
dependencies
=
transitive_dependencies_for_specs
(
target
.
non_test_specs
.
to_set
,
target
.
platform
,
all_specs
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
test_specs
.
to_set
,
target
.
platform
,
all_specs
).
group_by
(
&
:root
)
test_dependencies
.
delete_if
{
|
k
|
dependencies
.
key?
k
}
target
.
dependent_targets
=
pod_targets
.
reject
{
|
t
|
dependencies
[
t
.
root_spec
].
nil?
}
target
.
test_dependent_targets
=
pod_targets
.
reject
{
|
t
|
test_dependencies
[
t
.
root_spec
].
nil?
}
...
...
lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb
View file @
4730679b
...
...
@@ -29,7 +29,7 @@ module Pod
add_copy_resources_script_phase
(
native_target
)
UserProjectIntegrator
::
TargetIntegrator
.
create_or_update_user_script_phases
(
script_phases_for_specs
(
test_specs
),
native_target
)
end
specs
=
target
.
specs
.
reject
(
&
:test_specification?
)
specs
=
target
.
non_test_specs
UserProjectIntegrator
::
TargetIntegrator
.
create_or_update_user_script_phases
(
script_phases_for_specs
(
specs
),
target
.
native_target
)
end
end
...
...
lib/cocoapods/target/pod_target.rb
View file @
4730679b
...
...
@@ -49,7 +49,8 @@ module Pod
raise
"Can't initialize a PodTarget with only abstract TargetDefinitions"
if
target_definitions
.
all?
(
&
:abstract?
)
raise
"Can't initialize a PodTarget with an empty string scope suffix!"
if
scope_suffix
==
''
super
()
@specs
=
specs
@specs
=
specs
.
dup
.
freeze
@test_specs
,
@non_test_specs
=
@specs
.
partition
(
&
:test_specification?
)
@target_definitions
=
target_definitions
@sandbox
=
sandbox
@scope_suffix
=
scope_suffix
...
...
@@ -216,20 +217,16 @@ module Pod
# @return [Boolean] Whether the target has any tests specifications.
#
def
contains_test_specifications?
specs
.
any?
(
&
:test_specification?
)
!
test_specs
.
empty?
end
# @return [Array<Specification>] All of the test specs within this target.
#
def
test_specs
specs
.
select
(
&
:test_specification?
)
end
attr_reader
:test_specs
# @return [Array<Specification>] All of the non test specs within this target.
#
def
non_test_specs
specs
.
reject
(
&
:test_specification?
)
end
attr_reader
:non_test_specs
# @return [Array<Symbol>] All of the test supported types within this target.
#
...
...
spec/unit/installer/xcode/pods_project_generator/file_references_installer_spec.rb
View file @
4730679b
...
...
@@ -188,9 +188,9 @@ module Pod
describe
'Private Helpers'
do
describe
'#file_accessors'
do
it
'returns the file accessors'
do
pod_target_1
=
PodTarget
.
new
([
stub
(
'Spec'
)],
[
fixture_target_definition
],
config
.
sandbox
)
pod_target_1
=
PodTarget
.
new
([
stub
(
'Spec'
,
:test_specification?
=>
false
)],
[
fixture_target_definition
],
config
.
sandbox
)
pod_target_1
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
pod_target_2
=
PodTarget
.
new
([
stub
(
'Spec'
)],
[
fixture_target_definition
],
config
.
sandbox
)
pod_target_2
=
PodTarget
.
new
([
stub
(
'Spec'
,
:test_specification?
=>
false
)],
[
fixture_target_definition
],
config
.
sandbox
)
pod_target_2
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
installer
=
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target_1
,
pod_target_2
],
@project
)
roots
=
installer
.
send
(
:file_accessors
).
map
{
|
fa
|
fa
.
path_list
.
root
}
...
...
@@ -198,7 +198,7 @@ module Pod
end
it
'handles pods without file accessors'
do
pod_target_1
=
PodTarget
.
new
([
stub
(
'Spec'
)],
[
fixture_target_definition
],
config
.
sandbox
)
pod_target_1
=
PodTarget
.
new
([
stub
(
'Spec'
,
:test_specification?
=>
false
)],
[
fixture_target_definition
],
config
.
sandbox
)
pod_target_1
.
file_accessors
=
[]
installer
=
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target_1
],
@project
)
installer
.
send
(
:file_accessors
).
should
==
[]
...
...
spec/unit/installer_spec.rb
View file @
4730679b
...
...
@@ -373,7 +373,7 @@ module Pod
@analysis_result
=
Installer
::
Analyzer
::
AnalysisResult
.
new
@analysis_result
.
specifications
=
[]
@analysis_result
.
sandbox_state
=
Installer
::
Analyzer
::
SpecsState
.
new
@spec
=
stub
(
:name
=>
'Spec'
)
@spec
=
stub
(
:name
=>
'Spec'
,
:test_specification?
=>
false
)
@spec
.
stubs
(
:root
=>
@spec
)
@pod_targets
=
[
PodTarget
.
new
([
@spec
],
[
fixture_target_definition
],
config
.
sandbox
)]
@installer
.
stubs
(
:analysis_result
).
returns
(
@analysis_result
)
...
...
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